RosettaCodeData/Task/Power-set/OCaml/power-set-2.ml

2 lines
96 B
OCaml
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
let subsets xs = List.fold_right (fun x rest -> rest @ List.map (fun ys -> x::ys) rest) xs [[]]