On Fri, Jan 01, 2021 at 05:41:04PM -0800, ToddAndMargo via perl6-users wrote:
> On 1/1/21 6:32 AM, David Santiago wrote:
> > say $_ for {0.1+$_}...^5
>
> Is there a way to do this without the finger wagging?
>
> say $_ for {0.1+$_}...^2
If you're going to a sequence operator ("...") instead of a range operator
(".."), then you can specify the increment this way and it may be more readable:
> say $_ for 0.1, 0.2 ...^ 2;
Raku will auto-deduce the sequence from the values in the list on the LHS of
the sequence operator:
> say $_ for 0.6, 1.1 ...^ 10;
This can be of course extended -- to count from $a up to $b in steps of $x, one
can write:
> say $_ for $a, $a+$x ...^ $b
Note that in these examples the caret is part of the sequence operator, it's
not a prefix to the $b argument.
Pm