Course of Raku / Functional, concurrent, reactive, and web programming / Functional programming / Iterators / Exercises

Gather the cubes

Problem

Using gather and take, build a list of the cubes of the numbers 1, 2, 3, and 4. Print the list.

Example

The program prints:

[1 8 27 64]

Solution

See the solution

Course navigation

Lazy gather   |   Solution: Gather the cubes