Course of Raku / Functional, concurrent, reactive, and web programming / Functional programming / Reduction / Exercises
Comma-separated list
Problem
Using the reduce method with a block,
join the words 'Raku', 'is', 'fun' into one string with
', ' between the pieces, so the result reads
Raku, is, fun. The [~] metaoperator glues
pieces with nothing between them, so inserting a separator is a job for
a block.
Example
The program prints:
Raku, is, funSolution
Course navigation
← Solution: The longest string | Solution: Comma-separated list →