aol / cyclops

An advanced, but easy to use, platform for writing functional applications in Java 8.
Apache License 2.0
1.32k stars 136 forks source link

LazySeq : scanRight is not lazy #892

Closed johnmcclean closed 6 years ago

johnmcclean commented 6 years ago

scanRight can be implemented efficiently via foldRight, but this does not execute lazily. Proposed fix is to implement via stream().scanRight, this will return the result in inverse order (i.e. the intermediate results from left to right). It is more performant / efficient to do this. We could reverse this list (Vavr seems to do this), but other libraries also return the intermediate results in this order (e.g. Jool). Users can reverse the resultant list if they wish.

johnmcclean commented 6 years ago

Merged.