September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,16 +1,21 @@
|
|||
let comb m xs =
|
||||
let xs = Array.of_list xs in
|
||||
|
||||
if m > Array.length xs then
|
||||
[]
|
||||
else begin
|
||||
|
||||
let arr = Array.make (m+1) [] in
|
||||
arr.(0) <- [[]];
|
||||
|
||||
for j = 0 to Array.length xs - m do
|
||||
for i = 1 to m do
|
||||
arr.(i) <- arr.(i) @ List.map (fun ys -> xs.(j+i-1)::ys) arr.(i-1)
|
||||
arr.(i) <- arr.(i) @ List.map (fun ys -> xs.(j+i-1)::ys) arr.(i-1)
|
||||
done
|
||||
done;
|
||||
|
||||
arr.(m)
|
||||
|
||||
end
|
||||
;;
|
||||
comb 3 [0;1;2;3;4];;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue