Output range that applies function fun to each input before summing
import mir.math.common: powi; import mir.ndslice.slice: sliced; alias f = (double x) => (powi(x, 2)); MapSummator!(f, double, Summation.pairwise) x; x.put([0.0, 1, 2, 3, 4].sliced); assert(x.sum == 30.0); x.put(5); assert(x.sum == 55.0);
See Implementation
Output range that applies function fun to each input before summing