all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
|
|
@ -0,0 +1,12 @@
|
|||
# Empty list sorts to the empty list
|
||||
multi quicksort([]) { () }
|
||||
|
||||
# Otherwise, extract first item as pivot...
|
||||
multi quicksort([$pivot, *@rest]) {
|
||||
# Partition.
|
||||
my @before := @rest.grep(* before $pivot);
|
||||
my @after := @rest.grep(* !before $pivot);
|
||||
|
||||
# Sort the partitions.
|
||||
(quicksort(@before), $pivot, quicksort(@after))
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue