let rec gen xs =
  match xs with
  | [] -> [[]]
  | h :: rest ->
    let sub = gen rest in
    sub @ List.map (fun s -> h :: s) sub

;;

let all = gen [1; 2; 3; 4; 5; 6; 7; 8; 9; 10] in
let count = ref 0 in
List.iter (fun sub ->
  let sum = List.fold_left (+) 0 sub in
  if sum = 15 then count := !count + 1
) all;
!count
