Advertisement
bvdeenen

ocaml core List.sum

May 4th, 2019
1,058
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.15 KB | None | 0 0
  1. #require "core";;
  2. open Core;;
  3. let sum a = List.sum (module Int) a ~f:ident in List.range 0 100 |> List.map ~f:(fun x -> x*x) |> sum;;
  4. - : int = 328350
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement