My understanding is if you want to count by threes, starting at 2 and ending at
14, you should be able to write:
2, 5 ... 14
That is, the list-building operator looks at the previous two or three terms
preceding it to determine where to start and what "step function" to use, and
then looks at the first term following it to determine where to stop. The use
of lambda functions in the immediately preceding and following terms provides a
means to explicitly define the step function and the test condition,
respectively; but Perl 6 is supposed to be smart enough to intuit linear step
functions from two strictly numeric prior terms, geometric step functions from
three such terms, and a test condition that stops the series at '> $n' from a
numeric right term.
So:
1, 3 ... 13 # same as 1,3,5,7,9,11,13
1 ... 10 # same as 1,2,3,4,5,6,7,8,9,10
1, 2, 4 ... 100 # same as 1,2,4,8,16,32,64
and
2, 5 ... 14 # same as 2,5,8,11,14
Meanwhile, using Whatever for the test condition means "keep the series going
indefinitely":
1, 3 ... * # every positive odd number.
1 ... * # all counting numbers.
1, 2, 4 ... * # all powers of 2.
And using '...^' instead of '...' changes the default final test condition from
'> $n' to '>= $n':
1, 3 ...^ 13 # same as 1,3,5,7,9,11
1 ...^ 10 # same as 1,2,3,4,5,6,7,8,9
1, 2, 4 ...^ 100 # same as 1,2,4,8,16,32,64
In short, what Damian is talking about is the more powerful and reliable use of
the syntax; but the above approach (assuming it has been properly implemented)
is a more intuitive use that covers the most common cases. Make common things
easy, and make uncommon things possible.
Likewise, using Whatever in conjunction with operators is there to provide an
intuitive way to calculate the next term from the previous one(s):
1, *+2 ... 13 # start at 1, step by 2s, stop at 13.
1, 1, *+* ... * # each new term is the sum of the previous two.
1, 1, &infix:<+> ... * # same as last one.