my-solutions/codewars/ocaml/sum-of-positive/main.ml

2 lines
83 B
OCaml

let positive_sum ls =
List.fold_left ( + ) 0 (List.filter (fun x -> x > 0) ls);;