[squeak-dev] Re: Collection's #fold: vs #reduce:

Andreas Raab andreas.raab at gmx.de
Tue Nov 2 19:03:48 UTC 2010

On 11/2/2010 11:31 AM, Levente Uzonyi wrote:
>> more cuddly) and since we don't have map: (we have collect:) I don't find
>> the need to use reduce: compelling. But that's my preference. I won't
>> object if you replace fold: with reduce:/ I do note that Gilad used fold:
>> in Newspeak.
>> What do you prefer?
> I prefer the second option, because both names are widely used, but some
> people are only aware of the one which their previously used languages
> have. So this way we can avoid questions like "Why isn't there a
> method for folding in Squeak?".

If you go by familiarity, reduce is by far the obvious choice. Most of 
the popular dynamic languages use reduce:

PHP: http://php.net/manual/en/function.array-reduce.php
Python: http://docs.python.org/library/functions.html#reduce

What languages use fold?

   - Andreas

More information about the Squeak-dev mailing list