[squeak-dev] The Trunk: Collections-ul.587.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Nov 19 11:42:41 UTC 2014


Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.587.mcz

==================== Summary ====================

Name: Collections-ul.587
Author: ul
Time: 18 November 2014, 11:53:01.797 pm
UUID: 30ba8551-0c97-4cf5-b830-9386f272b8d2
Ancestors: Collections-ul.586

Optimized Interval >> #sum.

=============== Diff against Collections-ul.586 ===============

Item was added:
+ ----- Method: Interval>>sum (in category 'accessing') -----
+ sum
+ 	"Optimized version. Use the sum(n*i - k, i=a..b) = -1/2*(a - b - 1)*(n * (a + b) - 2 * k) equation with a = 1, n = step, b = self size."
+ 
+ 	| b |
+ 	b := self size.
+ 	^b * ((b + 1) * step - (step - start * 2)) / 2!



More information about the Squeak-dev mailing list