itertools
itertools copied to clipboard
Accumulate iterator adapter for rust itertools (like itertools.accumulate in Python itertools)
I don't find iterator adapter like itertools.accumulate(iterable[, func, *, initial=None]) in Rust itertools.
It would be nice to add it in.
Isn't this scan?
Yes it very similar to scan but it's not very obvious at first look. With initial=0 and the default func the addition.
(1..8).scan(0, |x, y| { *x += y; Some(*x) })
while people from coming Python would expect something more like
(1..8).some_name(0, |x, y| x + y)
Like in #147
EDIT: Playground example of accumulate[_add] functions.