Function itertools::fold
[−]
[src]
pub fn fold<I, B, F>(iterable: I, init: B, f: F) -> B where
I: IntoIterator,
F: FnMut(B, I::Item) -> B,
Perform a fold operation over the iterable.
IntoIterator
enabled version of i.fold(init, f)
use itertools::fold; assert_eq!(fold(&[1., 2., 3.], 0., |a, &b| f32::max(a, b)), 3.);