reduce -> fold?

Dragos Carp via Digitalmars-d digitalmars-d at puremagic.com
Fri Jan 29 05:56:48 PST 2016


On Friday, 29 January 2016 at 13:11:34 UTC, Luís Marques wrote:
> Just to bikeshed a little, I remember that when I first started 
> using std.algorithm I was ctrl-F'ing for "accumulate" and not 
> finding it quite often. D competes with C++ directly, so do 
> consider that name :-)

But not in python, where "accumulate"[1] is the generic 
equivalent of C++ "partial_sum"[2]. I like "fold" more.

BTW this week, a colleague of mine implemented a python 
"accumulate" in D. Is there any interest to contribute it to 
Phobos? How should this be named?

[1] 
https://docs.python.org/3/library/itertools.html#itertools.accumulate
[2] http://en.cppreference.com/w/cpp/algorithm/partial_sum


More information about the Digitalmars-d mailing list