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.
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.