Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,17 @@
module PowerSet(S: Set.S) =
struct
include Set.Make (S)
let map f s =
let work x r = add (f x) r in
fold work s empty
;;
let powerset s =
let base = singleton (S.empty) in
let work x r = union r (map (S.add x) r) in
S.fold work s base
;;
end;; (* PowerSet *)

View file

@ -0,0 +1 @@
let subsets xs = List.fold_right (fun x rest -> rest @ List.map (fun ys -> x::ys) rest) xs [[]]