# New Ticket Created by Will Coleda
# Please include the string: [perl #117635]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=117635 >
... instead of each only taking what they need. This sample demonstrates a
problem found in S04-statements/gather.t that was until recently marked as
"nom regression" - if the 13 below is a Whatever, @sixes[0] will never
complete, waiting for @evens to terminate.
💈 cat gather.t
sub grep-div(@a, $n) {
gather for @a {
say "DIV BY $n, VALUE $_";
take $_ if $_ %% $n;
}
}
my @evens := grep-div((1...13), 2);
my @sixes := grep-div(@evens, 6);
say @sixes[0];
💈 ./perl6 gather.t
DIV BY 2, VALUE 1
DIV BY 2, VALUE 2
DIV BY 2, VALUE 3
DIV BY 2, VALUE 4
DIV BY 2, VALUE 5
DIV BY 2, VALUE 6
DIV BY 2, VALUE 7
DIV BY 2, VALUE 8
DIV BY 2, VALUE 9
DIV BY 2, VALUE 10
DIV BY 2, VALUE 11
DIV BY 2, VALUE 12
DIV BY 2, VALUE 13
DIV BY 6, VALUE 2
DIV BY 6, VALUE 4
DIV BY 6, VALUE 6
6
--
Will "Coke" Coleda