Course of Raku / Functional, concurrent, reactive, and web programming / Functional programming / Data feeds / Exercises / A feed pipeline
Solution: A feed pipeline
Here is a possible solution to the task.
Code
(1..8)
==> grep(* > 3)
==> map(* * 2)
==> my @result;
say @result;🦋 You can find the source code in the file feed-pipeline.raku.
Output
[8 10 12 14 16]Comments
The first stage keeps the numbers greater than
3(that is4, 5, 6, 7, 8); the second doubles each one.Each
==>passes its result to the next stage, and the last collects it into@result.