ocaml: phase 5.1 combinations.ml baseline (C(9, 4) = 126)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 23s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 23s
Pascal-recursion combination enumerator:
let rec choose k xs =
if k = 0 then [[]]
else match xs with
| [] -> []
| h :: rest ->
List.map (fun c -> h :: c) (choose (k - 1) rest)
@ choose k rest
C(9, 4) = |choose 4 [1; ...; 9]| = 126
Tests pure-functional enumeration with List.map + closure over h,
@ append, [] | h :: rest pattern match on shrinking input.
200 baseline programs total -- milestone.
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
"calc.ml": 13,
|
||||
"catalan.ml": 42,
|
||||
"closures.ml": 315,
|
||||
"combinations.ml": 126,
|
||||
"convex_hull.ml": 5,
|
||||
"coin_change.ml": 6,
|
||||
"coin_min.ml": 6,
|
||||
|
||||
Reference in New Issue
Block a user