Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,5 @@
|
|||
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)
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
let mean_floats xs =
|
||||
if xs = [] then
|
||||
invalid_arg "empty list"
|
||||
else
|
||||
let total, length =
|
||||
List.fold_left
|
||||
(fun (tot,len) x -> (x +. tot), len +. 1.)
|
||||
(0., 0.) xs
|
||||
in
|
||||
(total /. length)
|
||||
;;
|
||||
|
||||
|
||||
let mean_ints xs =
|
||||
if xs = [] then
|
||||
invalid_arg "empty list"
|
||||
else
|
||||
let total, length =
|
||||
List.fold_left
|
||||
(fun (tot,len) x -> (x + tot), len +. 1.)
|
||||
(0, 0.) xs
|
||||
in
|
||||
(float total /. length)
|
||||
;;
|
||||
Loading…
Add table
Add a link
Reference in a new issue