Course of Raku / Functional, concurrent, reactive, and web programming / Reactive programming / Supplies / Exercises / Tap a list

Solution: Tap a list

Here is a possible solution to the task.

Code

Supply.from-list('red', 'green', 'blue').tap(-> $v { say $v });

🦋 You can find the source code in the file tap-a-list.raku.

Output

red
green
blue

Comments

  1. Supply.from-list emits the three strings in order.

  2. The tap runs once for each, printing it.

Course navigation

Tap a list   |   Filter a supply