Course of Raku / Functional, concurrent, reactive, and web programming / Reactive programming / Supplies / Transforming a supply

Quiz — Transforming a supply

What does the following program print?

my @out;
Supply.from-list(1, 2, 3).map(* ** 2).tap(-> $v { @out.push($v) });
say @out;
0[1 2 3]
1[1 4 9]
0[2 4 6]
014

map(* ** 2) produces a new supply that squares each value. The tap collects 1, 4, 9 into @out.

Course navigation

Transforming a supply   |   Tap a list