Averages/Arithmetic mean: Difference between revisions

(→‎{{header|UnixPipes}}: Add {{incorrect}}; there is a race between parallel commands.)
Line 629:
 
let mean_series list =
let reca, f_ = List.fold_left (fun (a, n) h -> avg a (float h) n, n + 1) (0., 0) list =in
f 0. 0 lista</lang>
match list with
| [] -> a
| h :: t -> f (avg a (float h) n) (n + 1) t
f 0. 0 list</lang>
 
Checking this:
Line 642 ⟶ 639:
We can also make do with the built-in ''List.average'' function
List.average [4;1;7;5;8;4;5;2;1;5;2;5]
 
=={{header|GAP}}==
<lang gap>Mean := function(v)
Anonymous user