It would be slightly prettier if take could harvest a value en passant.sub group (*@array is copy) { gather { while @array { take [ gather { my $h = shift @array; take $h; while @array and $h eq @array[0] { take shift @array; } } ]; } } }
In reply to Re^2: 99 Problems in Perl6 (Lisp, Prolog, Haskell)
by TimToady
in thread 99 Problems in Perl6
by Ovid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |