You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It currently requires more unquoting and quoting than desirable to
generate source code that uses separators.
In the following code the newlines are separators. If they would not be,
there will be superfluous newlines generated which is not nice.
extends = [trim("<i>") | i <- h.imports, i is \extend];
imports = [trim("<i>") | i <- h.imports, i is \default];
grammar = [trim("<i>") | i <- h.imports, i is \syntax];
newHeader = "<for (i <- sort(extends)) {><i>
'<}>"[..-1] +
"<if (extends != []) {>
'
'<}><for (i <- sort(imports)) {><i>
'<}>"[..-1] +
"<if (imports != [] && grammar != []) {>
'
'<}><for (i <- grammar) {><i>
'<}>"[..-1];
If the for loop could know it was generating separated lists instead of a normal lists, then we would not have to remove the trailing newlines with [..-1] and unquote and quote again after every block, and we would not have to test for emptiness of predecessors:
extends = [trim("<i>") | i <- h.imports, i is \extend];
imports = [trim("<i>") | i <- h.imports, i is \default];
grammar = [trim("<i>") | i <- h.imports, i is \syntax];
newHeader = "<for-sep (i <- sort(extends)) {><i>
'<}>
'<for-sep (i <- sort(imports)) {><i>
'<}>
'<for-sep (i <- grammar) {><i>
'<}>";
Where the literal characters after the last interpolated element would not be printed because that would not be a separator.
This code is much cleaner.
The name for-sep is up for debate of course. Alternatives welcome.
The text was updated successfully, but these errors were encountered:
It currently requires more unquoting and quoting than desirable to
generate source code that uses separators.
In the following code the newlines are separators. If they would not be,
there will be superfluous newlines generated which is not nice.
If the
for
loop could know it was generating separated lists instead of a normal lists, then we would not have to remove the trailing newlines with[..-1]
and unquote and quote again after every block, and we would not have to test for emptiness of predecessors:Where the literal characters after the last interpolated element would not be printed because that would not be a separator.
This code is much cleaner.
The name
for-sep
is up for debate of course. Alternatives welcome.The text was updated successfully, but these errors were encountered: