Align fold, reduce and scan ops with scala idoms
jpork opened this issue · 0 comments
jpork commented
It would be nice to have some inconsistencies amongst fold, reduce and scan ops to be removed.
In Scala collections there are mainly three flavours of these operations, e.g.
- reduce
- reduceLeft
- reduceRight
Which makes - in my opinion - no sence for streams. There is only one direction from start to end. No need to bother with left or right.
Another category would be operations with initial value or not. In Scala reduce is without initial value. Fold and scan have an initial value. Fold and scan with initial value change the result type according to the initial values type.
The *With operations like scanWith and foldWith declare the initial value as computation by using the by-name argument passing.
I make a proposal via PR.