reduce -> fold?

Brad Anderson via Digitalmars-d digitalmars-d at puremagic.com
Fri Jan 29 08:38:23 PST 2016


On Friday, 29 January 2016 at 12:08:01 UTC, Andrei Alexandrescu 
wrote:
> As has been discussed before there's been discussion about 
> std.algorithm.reduce taking the "wrong" order of arguments (its 
> definition predates UFCS). I recall the conclusion was there'd 
> be subtle ambiguities if we worked reduce to implement both 
> orders.
>
> So the next best solution is to introduce a new name such as 
> the popular "fold", and put them together in the documentation.
>
>
> Thoughts?
>
> Andrei

+1

Let's make sure to write the half dozen other names for it in the 
documentation so people coming to D from other languages can 
easily find it.

And just for completeness, here is monarchdodra's valiant but 
ultimately unsuccessful pull request which attempted fix reduce: 
https://github.com/D-Programming-Language/phobos/pull/861#issuecomment-20760448


More information about the Digitalmars-d mailing list