Data update

This commit is contained in:
Ingy döt Net 2023-09-01 09:35:06 -07:00
parent 61b93a2cd1
commit 5af6d93694
858 changed files with 20572 additions and 2082 deletions

View file

@ -0,0 +1,10 @@
// Strand sort. Nigel Galloway: August 18th., 2023
let fN g=let mutable n=g in fun g->if n>g then false else n<-g; true
let fI n=let fN=fN(List.head n) in List.partition fN n
let rec fG n g=[match n,g with [],g|g,[]->yield! g
|n::gn,i::ng when n<i->yield n; yield! fG gn g
|n,g::ng->yield g; yield! fG n ng]
let rec fL n g=match n with []->g |_->let n,i=fI n in fL i (n::g)
let sort n=fL n []|>List.fold(fun n g->fG n g)[]
printfn "%A" (sort ["one";"two";"three";"four"]);;
printfn "%A" (sort [2;3;1;5;11;7;5])