Skip to content

Instantly share code, notes, and snippets.

@colomon
Created August 27, 2015 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colomon/14fab50530ef7011b316 to your computer and use it in GitHub Desktop.
Save colomon/14fab50530ef7011b316 to your computer and use it in GitHub Desktop.
So... if you run the very-broken script, everything works properly, both running the version of
very-broken-combinations from core and the indentical but for name copy very-broken-combinations-local
here. If you run very-broken-combinations from the REPL, it will fail:
> very-broken-combinations(3,2)
([9 10] [9 10] [9 10] [9 10] [9 10])
The original combinations bug also occurred when running combinations.t, which is how I discovered it.
I haven't tried setting up a test file for very-broken-combinations.
sub very-broken-combinations-local($n, $k) {
my @result;
my $value = 1;
gather for 0..4 {
for 0..1 {
@result[$_] = $value++;
}
take @result;
}
}
say very-broken-combinations(3,2);
say very-broken-combinations-local(3,2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment