Skip to content

Commit

Permalink
Generator to ... is not an argument, but a value in the list
Browse files Browse the repository at this point in the history
It doesn't even have to be a literal.

    > my $lhs = (5, { $_ * 2 });
    > say $lhs ... 40;
    (5 10 20 40)
  • Loading branch information
Juerd committed Jun 28, 2018
1 parent 96ec084 commit 33e27ba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion doc/Language/operators.pod6
Original file line number Diff line number Diff line change
Expand Up @@ -2275,7 +2275,7 @@ with a default generator of *.succ
say (1 ... *)[^5]; # OUTPUT: «(1 2 3 4 5)␤»
Custom generators need to be the last argument before the '...' operator.
Custom generators need to be the last element of the list before the '...' operator.
This one takes two arguments, and generates the Fibonacci numbers
say (1, 1, -> $a, $b { $a + $b } ... *)[^8]; # OUTPUT: «(1 1 2 3 5 8 13 21)␤»
Expand Down

0 comments on commit 33e27ba

Please sign in to comment.