The Trunk: Collections-ul.587.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Collections-ul.587.mcz

commits-2
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!