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

Levente Uzonyi leves at elte.hu
Tue Nov 2 17:16:03 UTC 2010


we have these two methods which do exactly the same thing. #reduce: was 
added by Andreas during the developement of Squeak 4.1. #fold was added by 
Eliot for Cog VMMaker compatibility. One of them is superfluous. I can 
image the following solutions:

1) Replace senders of #fold: in VMMaker to use #reduce:, and remove 
#fold: from the image.

2) Replace #fold:'s implementation to self reduce: aBlock. I benchmarked 
the two methods and #reduce: is a bit faster on CogVM. There's no 
difference on SqueakVM.


More information about the Squeak-dev mailing list