RosettaCodeData/Task/Combinations/Standard-ML/combinations.ml
2023-07-01 13:44:08 -04:00

6 lines
170 B
Standard ML

fun comb (0, _ ) = [[]]
| comb (_, [] ) = []
| comb (m, x::xs) = map (fn y => x :: y) (comb (m-1, xs)) @
comb (m, xs)
;
comb (3, [0,1,2,3,4]);