11 lines
308 B
Forth
11 lines
308 B
Forth
|
namespace Sanchime.Algrithm.Sort
|
||
|
[<AutoOpen>]
|
||
|
module Quick =
|
||
|
|
||
|
let rec qsort sorted = function
|
||
|
| [] -> []
|
||
|
| [x] -> [x]
|
||
|
| x::xs ->
|
||
|
let smaller,larger = xs |> List.partition (fun i -> sorted i x)
|
||
|
(qsort sorted smaller) @ [x] @ qsort sorted larger
|
||
|
|