Course of Raku / Functional, concurrent, reactive, and web programming / Functional programming / Data feeds / The backward feed

Quiz — The backward feed

What does the following program print?

my @out <== map(* + 1) <== (10, 20, 30);
say @out;
1[11 21 31]
0[31 21 11]
0[30 20 10]
0[10 20 30]

<== changes only the direction in which the pipeline is written, not the order of the data. The source (10, 20, 30) flows in — target on the left — and map(* + 1) adds one to each element in place, giving [11 21 31]. A backward feed never reverses the elements; for that you would need an explicit reverse.

Course navigation

The backward feed   |   Feed the big numbers