Course of Raku / Functional, concurrent, reactive, and web programming / Functional programming / Data feeds / Exercises / Sort with a feed

Solution: Sort with a feed

Here is a possible solution to the task.

Code

(3, 1, 2) ==> sort() ==> my @sorted;
say @sorted;

🦋 You can find the source code in the file feed-sorted.raku.

Output

[1 2 3]

Comments

  1. The feed sends the three numbers into sort, which orders them.

  2. The sorted result flows into @sorted.

Course navigation

Sort with a feed   |   Iterators