1 2 3 4 5 6 7
# You can use that in most places you'd expect, even assigning to an array my @numbers = ^20; my @seq = 3, 9 ... * > 95; # 3 9 15 21 27 [...] 81 87 93 99 @numbers[5..*] = 3, 9 ... *; # even though the sequence is infinite, # only the 15 needed values will be calculated. say @numbers; #=> 0 1 2 3 4 3 9 15 21 [...] 81 87 # (only 20 values)
1 2 3 4
my @numbers = ^20; @numbers.say; @numbers[5..*] = 3, 9 ... *; @numbers.say;
1
2
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19