in reply to Re: Pugs now works - but how?
in thread Hello Perl 6. Running pugs on Windows
Perhaps also helpful is the close equivalent in Perl5. No magical multi-methods, and a bit more verbose... but not too shabby. Come to think of it this should work fine in Perl6 as well, eh?
sub quicksort { return unless @_; my ($x, @xs) = @_; my @pre = grep{ $_ < $x } @xs; my @post = grep{ $_ >= $x } @xs; (quicksort(@pre), $x, quicksort(@post)); } my @a = quicksort(1, 5, 2, 4, 3); print "@a\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
If only I could vote twice...
by rg0now (Chaplain) on Feb 19, 2005 at 23:41 UTC |