Re:How to use array reduce for more than just numbers
by saagarjha on Sunday June 02, 2019 @11:50AM
(#20076164)
Does JavaScript have adapters to covert lists into generators or lazy iterators?
[ Parent
| on HN ]
Re:How to use array reduce for more than just numbers
by hn_throwaway_99 on Sunday June 02, 2019 @12:43PM
(#20076496)
Unfortunately not in a way that can optimize these methods. This is one reason the Java Streams API, which has a similar purpose (e.g. map, filter, flatMap, reduce, etc.), is a better design IMO because you can chain together method calls without creating (and iterating) the full array at each step.