Function fold
pub fn fold<I, B, F>(iterable: I, init: B, f: F) -> B
Available on crate feature
dep_itertools
only.Expand description
Perform a fold operation over the iterable.
IntoIterator
enabled version of Iterator::fold
.
use itertools::fold;
assert_eq!(fold(&[1., 2., 3.], 0., |a, &b| f32::max(a, b)), 3.);