in reply to Hello Perl 6. Running pugs on Windows
However, if you check out the current repository, you'll find an example/quicksort.p6 that indeed works, using "multi sub" dispatch. I'll list you in the AUTHORS file, if you'd let me know your name.
The code in the repository looks like this:
use v6; multi sub quicksort ( ) { () } multi sub quicksort ( *$x, *@xs ) { my @pre = @xs.grep{ $_ < $x }; my @post = @xs.grep{ $_ >= $x }; (@pre.quicksort, $x, @post.quicksort); } (1, 5, 2, 4, 3).quicksort.say;
I need to check with p6l folks on whether quicksort() can match a slurpy list this way. It is possible that quicksort( *[] ) would be a more accurate. Once I found out the answer, I'll fix the examples accordingly.
Thanks,
/Autrijus/
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: It now works. :)
by pernod (Chaplain) on Feb 18, 2005 at 09:26 UTC | |
by audreyt (Hermit) on Feb 18, 2005 at 11:02 UTC | |
by pernod (Chaplain) on Feb 18, 2005 at 13:21 UTC | |
by audreyt (Hermit) on Feb 18, 2005 at 14:23 UTC |