Course of Raku / Advanced / Subroutines / Calling with a colon 🆕 / Exercises

Sort with a colon

Problem

Using the colon call form, sort the words pear, fig, apple, kiwi by their length, from shortest to longest. Pass the sort key as a Whatever expression rather than a block. Print the result.

Example

The program prints:

(fig pear kiwi apple)

Solution

See the solution

Course navigation

Solution: Join with a colon   |   Solution: Sort with a colon