http://www.perlmonks.org?node_id=464095


in reply to Re^3: Perl6 Contest #2: P6 That Doesn't Look Like P5
in thread Perl6 Contest #2: P6 That Doesn't Look Like P5

Roy, I tried your code on the documentation example:
my $N = 4; my $depth = 3; my $i2 = nested_for([ [ 0..$N ], ( sub { [$_+1..$N] } ) x ($depth-1), ]); print "@args\n" while @args = $i2->();

There seems to be a problem when the range hits the top. The output is:

0 1 2 0 1 3 0 1 4 0 2 3 0 2 4 0 3 4 0 4 1 2 3 1 2 4 1 3 4 1 4 2 3 4 2 4 3 4 4