Course of Raku / Functional, concurrent, reactive, and web programming / Functional programming / Iterators / Exercises
Sum with pull-one
Problem
Add up the numbers in the list 3, 7, 5 by driving an
iterator directly: get one with .iterator
and call pull-one in a loop until it returns
IterationEnd. Do not use a for loop,
sum, or a reduction. Print the total.
Example
The program prints:
15