I'm trying to find the average of a list of floats.
let avg l =
List.fold_left ( +. ) 0 l /. List.length l;;
How does List.fold_left work? (Applies the first argument to a list (the third arg)... but then what is the second argument?)
Toplevel returns this error:
Characters 43-44:
List.fold_left ( +. ) 0 l /. List.length l;;
^
Error: This expression has type int but is here used with type float
What is the preferred way to iterate through a list in OCaml?