RosettaCodeData/Task/Averages-Arithmetic-mean/OCaml/averages-arithmetic-mean-1.ocaml
2023-07-01 13:44:08 -04:00

5 lines
168 B
Text

let mean_floats = function
| [] -> 0.
| xs -> List.fold_left (+.) 0. xs /. float_of_int (List.length xs)
let mean_ints xs = mean_floats (List.map float_of_int xs)