2 ms·
What about fold? In rust iterators there's both fold (you supply the initial value) and reduce (it uses the first element as the initial value, doesn't work on
by nextaccountic 18d ago
What about fold?
In rust iterators there's both fold (you supply the initial value) and reduce (it uses the first element as the initial value, doesn't work on empty iterators)
https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.fold https://doc.rust-lang.org/std/iter/trait.Iterator.html#metho...
https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.reduce https://doc.rust-lang.org/std/iter/trait.Iterator.html#metho...