Andreas Raab uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.205.mcz==================== Summary ====================
Name: Collections-ul.205
Author: ul
Time: 21 November 2009, 5:00:56 am
UUID: 2c312405-e447-944a-b5f9-23aeab2817a2
Ancestors: Collections-ar.204
A proposal to solve the issues with #collect:.
=============== Diff against Collections-ar.204 ===============
Item was added:
+ ----- Method: Collection>>fillFrom:with: (in category 'private') -----
+ fillFrom: aCollection with: aBlock
+ "Evaluate aBlock with each of aCollections's elements as the argument.
+ Collect the resulting values into self. Answer self."
+
+ aCollection do: [ :each |
+ self add: (aBlock value: each) ]!
Item was added:
+ ----- Method: ArrayedCollection>>fillFrom:with: (in category 'private') -----
+ fillFrom: aCollection with: aBlock
+ "Evaluate aBlock with each of aCollections's elements as the argument.
+ Collect the resulting values into self. Answer self."
+
+ | index |
+ index := 0.
+ aCollection do: [ :each |
+ self at: (index := index + 1) put: (aBlock value: each) ]!
Item was added:
+ ----- Method: Collection>>collect:as: (in category 'enumerating') -----
+ collect: aBlock as: aClass
+ "Evaluate aBlock with each of the receiver's elements as the argument.
+ Collect the resulting values into an instance of aClass. Answer the resulting collection."
+
+ ^(aClass new: self size) fillFrom: self with: aBlock!
Item was added:
+ ----- Method: Dictionary>>fillFrom:with: (in category 'private') -----
+ fillFrom: aCollection with: aBlock
+ "Evaluate aBlock with each of aCollections's elements as the argument.
+ Collect the resulting values into self. Answer self."
+
+ aCollection keysAndValuesDo: [ :key :value |
+ self at: key put: (aBlock value: value) ]!
Item was added:
+ ----- Method: Collection>>collect:into: (in category 'enumerating') -----
+ collect: aBlock into: aCollection
+ "Evaluate aBlock with each of the receiver's elements as the argument.
+ Collect the resulting values into aCollection. Answer aCollection."
+
+ ^aCollection fillFrom: self with: aBlock!