langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
8
Task/Combinations/OCaml/combinations.ocaml
Normal file
8
Task/Combinations/OCaml/combinations.ocaml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
let rec comb m lst =
|
||||
match m, lst with
|
||||
0, _ -> [[]]
|
||||
| _, [] -> []
|
||||
| m, x :: xs -> List.map (fun y -> x :: y) (comb (pred m) xs) @
|
||||
comb m xs
|
||||
;;
|
||||
comb 3 [0;1;2;3;4];;
|
||||
Loading…
Add table
Add a link
Reference in a new issue