fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

Idiom # 53: Join a list of strings

See programming-idioms.org:

Code

Use as_string to join the elements with a separator:

Alternatively, fold joins elements of a sequence into a value of the element type. For type string, such operations are defined in feature strings. For concatenation with a separator, strings.concat sep is the operation to use.

Mathematically speaking, such an operation is called a monoid. This is why the type of the argument of fold is Monoid, while the operations declared in strings inherit from Monoid.

Runnable Example

Using as_string.

Using fold.

last changed: 2026-11-23