During code generation it happens quite frequently that a list of string (e.g., code for method method parameters or arguments) needs to be joined together by a common separator. Is there a builtin function for this?

Asked by Sven Stork on 15 January 2013 at 23:06

The to achieve this is first to use the separate-by function to inject the separator between the list elements and then call the concat-strings function to combine the list of strings into a single string.


codegen-java:
Call(r, m, args) -> $[ ([r’]).m]
where
r’ := r;
argsCode := <map(codegen-java)> args;
argsCodeWithCommas := <separate-by(|“,”)> argsCode;
args’ := argsCodeWithCommas

Answered by Sven Stork on 15 January 2013 at 23:16