equal
deleted
inserted
replaced
1231 } sum = (16 / 63) ). |
1231 } sum = (16 / 63) ). |
1232 " |
1232 " |
1233 ! |
1233 ! |
1234 |
1234 |
1235 sum:aBlock |
1235 sum:aBlock |
1236 "for each element in the receiver, evaluate the argument, aBlock |
1236 "for each element in the receiver, evaluate the argument, aBlock and sum up the results. |
1237 and sum up the results. Return the total sum or 0 for an empty collection. |
1237 Return the total sum or 0 for an empty collection. |
1238 Similar to (self collect...) sum, but avoids creation of an intermediate collection." |
1238 Similar to (self collect...) sum, but avoids creation of an intermediate collection." |
1239 |
1239 |
1240 |sum| |
1240 |sum| |
1241 |
1241 |
1242 self do:[:element | |
1242 self do:[:element | |
1253 |
1253 |
1254 " |
1254 " |
1255 ((1 to:10) collect:[:n | n squared]) sum |
1255 ((1 to:10) collect:[:n | n squared]) sum |
1256 ((1 to:10) sum:[:n | n squared]) |
1256 ((1 to:10) sum:[:n | n squared]) |
1257 " |
1257 " |
|
1258 |
|
1259 "Modified: / 23-08-2010 / 18:19:42 / cg" |
1258 ! ! |
1260 ! ! |
1259 |
1261 |
1260 !Collection methodsFor:'converting'! |
1262 !Collection methodsFor:'converting'! |
1261 |
1263 |
1262 asArray |
1264 asArray |
3786 ! ! |
3788 ! ! |
3787 |
3789 |
3788 !Collection class methodsFor:'documentation'! |
3790 !Collection class methodsFor:'documentation'! |
3789 |
3791 |
3790 version |
3792 version |
3791 ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.247 2010-08-23 09:08:52 cg Exp $' |
3793 ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.248 2010-08-23 17:33:19 cg Exp $' |
3792 ! |
3794 ! |
3793 |
3795 |
3794 version_CVS |
3796 version_CVS |
3795 ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.247 2010-08-23 09:08:52 cg Exp $' |
3797 ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.248 2010-08-23 17:33:19 cg Exp $' |
3796 ! ! |
3798 ! ! |
3797 |
3799 |
3798 Collection initialize! |
3800 Collection initialize! |