Course of Raku / Functional, concurrent, reactive, and web programming / Reactive programming / react and whenever / Exercises
Sort into two arrays
Problem
Using a react block, split one stream into two
collections. Watch a supply built from 4, 42, 7, 100, 15
and, inside the whenever body, push every value greater
than 10 into @big and the rest into
@small. Print both arrays after the react block
finishes.
Example
The program prints:
[4 7]
[42 100 15]Solution
Course navigation
← Solution: Upper-case with react | Solution: Sort into two arrays →