Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dependant invocations of gather/take in same sub forced to complete in order #3105

Closed
p6rt opened this issue Apr 17, 2013 · 4 comments
Closed

Comments

@p6rt
Copy link

p6rt commented Apr 17, 2013

Migrated from rt.perl.org#117635 (status was 'resolved')

Searchable as RT117635$

@p6rt
Copy link
Author

p6rt commented Apr 17, 2013

From @coke

... 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

@p6rt
Copy link
Author

p6rt commented Apr 28, 2015

From @jnthn

On Tue Apr 16 20​:32​:30 2013, coke wrote​:

... 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

After fixing a scoping bug, the spectest in question now passes. Unfudged it; resolving ticket.

@p6rt
Copy link
Author

p6rt commented Apr 28, 2015

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Apr 28, 2015

@jnthn - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Apr 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant