Mantis - Squeak
Viewing Issue Advanced Details
7326 Collections minor always 03-31-09 02:41 02-06-11 23:48
lucian3  
leves  
normal  
closed  
fixed  
none    
none trunk  
0007326: #sum and #average do not work properly with empty collections
Sending #sum or #average to an empty collection will yield an "attempt to index non-existent element..." error. #sum and #average should check first to see if the collection is empty and then, if it is, either return zero (my preferred behavior) or raise a more appropriate error.

Notes
(0013908)
leves   
11-07-10 02:21   
This was solved by reimplementing #sum using #reduce:.