Averages/Arithmetic mean: Difference between revisions

(→‎{{header|OCaml}}: using pattern matching instead of if-then-else, as usual in ocaml)
Line 589:
These functions return a float:
 
<lang ocaml>let mean_floats xs = 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)</lang>
Anonymous user