Course of Raku / Functional, concurrent, reactive, and web programming / Reactive programming / Live and on-demand supplies / Exercises

Two taps

Problem

Create an on-demand supply from the numbers 1, 2, 3. Tap it twice with two different pipelines — one that doubles each value, one that triples it — collecting into two separate arrays. Print both arrays to show that each tap independently received the whole sequence.

Example

The program prints:

[2 4 6]
[3 6 9]

Solution

See the solution

Course navigation

Live supplies   |   Solution: Two taps