Course of Raku / Advanced / Subroutines / Calling with a colon 🆕 / Exercises / Join with a colon
Solution: Join with a colon
Here is a possible solution to the task.
Code
say <a b c>.reverse.join: '-';🦋 You can find the source code in the file colon-join.raku.
Output
c-b-aComments
.reversekeeps its ordinary form because it is in the middle of the chain.joincomes last, so it can use the colon, passing'-'exactly asjoin('-')would.The list reversed to
c, b, ais then joined with dashes, givingc-b-a. The colon form works with ordinary values, not only blocks.