Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,21 @@
let rec split_at n xs =
match n, xs with
0, xs ->
[], xs
| _, [] ->
failwith "index too large"
| n, x::xs when n > 0 ->
let xs', xs'' = split_at (pred n) xs in
x::xs', xs''
| _, _ ->
invalid_arg "negative argument"
let rec merge_sort cmp = function
[] -> []
| [x] -> [x]
| xs ->
let xs, ys = split_at (List.length xs / 2) xs in
List.merge cmp (merge_sort cmp xs) (merge_sort cmp ys)
let _ =
merge_sort compare [8;6;4;2;1;3;5;7;9]