Sorting algorithms/Quicksort: Difference between revisions

Content added Content deleted
imported>Rcmlz
imported>Rcmlz
Line 8,270: Line 8,270:
=={{header|Raku}}==
=={{header|Raku}}==
<syntaxhighlight lang="raku" line>
<syntaxhighlight lang="raku" line>
#| Recursive, single-thread, single-pass, quicksort implementation
#| Recursive, single-thread, random pivot, single-pass, quicksort implementation
sub quicksort(@a) {
sub quicksort(\a) {
return @a if @a.elems < 2;
return a if a.elems < 2;
my $pivot = @a.pick;
my \pivot = a.pick;
my %prt{Order} is default([]) = @a.classify: * cmp $pivot;
my %prt{Order} is default([]) = a.classify: * cmp pivot;
|samewith(%prt{Less}), |%prt{Same}, |samewith(%prt{More})
|samewith(%prt{Less}), |%prt{Same}, |samewith(%prt{More})
}
}