March 2014 update

This commit is contained in:
Ingy döt Net 2014-04-02 16:56:35 +00:00
parent 09687c4926
commit a25938f123
1846 changed files with 21876 additions and 5203 deletions

View file

@ -0,0 +1,16 @@
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)
done
done;
arr.(m)
end
;;
comb 3 [0;1;2;3;4];;