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

Paolo Bonzini bonzini at gnu.org
Mon Aug 11 13:48:37 UTC 2008


> 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



More information about the Squeak-dev mailing list