The only way to do this using only one iteration when the functions are black boxes is to use a function Seq.cache(which evaluates the sequence once and stores the results in memory) or convert the sequence to another, memory representation.
seq<T> , , , , .
, . , fold. , :
let maxv = Seq.fold max Int32.MinValue input
let minv = Seq.fold min Int32.MaxValue input
, , :
Seq.fold (fun (s1, s2) v ->
(max s1 v, min s2 v)) (Int32.MinValue, Int32.MaxValue) input
- , :
let par f g (i, j) v = (f i v, g j v)
Seq.fold (par max min) (Int32.MinValue, Int32.MaxValue) input
, fold, , (Int32.MinValue ), , () ( , , - ). , , , . :
let (count, sum) = Seq.fold (fun (count, sum) v ->
(count + 1.0, sum + v)) (0.0, 0.0) input
let mean = sum / count