[squeak-dev] Re: Collection>>sum implementation

Jason Johnson jason.johnson.081 at gmail.com
Mon Aug 11 15:33:45 UTC 2008


On Mon, Aug 11, 2008 at 3:48 PM, Paolo Bonzini <bonzini at gnu.org> wrote:
>
>> As it turns out there exists a more efficient implementation of this
>> method in Lukas' Magritte-Model package.  I would propose his method
>> be promoted to a core method so #sum could be rewritten as:
>>
>> sum
>>     "sum the reciever"
>>     ^ self reduce: [:accum :each| accum + each ]
>
> This method is called #fold: in VisualWorks, GNU Smalltalk and others.
>
> Paolo

Ah ok.  It's called reduce in python and Lisp, and that's also what
Lukas named it in his package.



More information about the Squeak-dev mailing list