Course of Raku / Advanced / Containers / Contexts 🆕 / Exercises
Item or list
Problem
Take the array 1, 2, 3 and pack it into a scalar
$x using the item contextualiser, so
$x holds the whole array as a single value. Then use the
list contextualiser to run a for loop over
$x, counting the iterations. Because list context spreads
the packed array back into its elements, the loop runs three times.
Print the count.
Example
The program prints:
3