| x :: xs, m -> [ for xs in impl (xs, m - 1) -> x :: xs ] @ impl (xs, m)
let rec impl k = function
| x :: xs, m -> impl (fun acc -> impl (fun xxs -> k ([ for xs in xxs -> x :: xs ] @ acc)) (xs, m - 1)) (xs, m)
fun xs m -> impl id (xs, m)
let combTailRecNoAppend =
let rec impl k = function
| x :: xs, m -> impl (fun acc -> impl (List.fold (fun acc -> cons x >> flip cons acc) acc >> k) (xs, m - 1)) (xs, m)
fun xs m -> impl id (xs, m)
[ comb; combTailRec; combTailRecNoAppend ]
foo ([ 50 .. 10 .. 90 ], 3)