The Inbox: Collections-fn.847.mcz

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

The Inbox: Collections-fn.847.mcz

commits-2
A new version of Collections was added to project The Inbox:
http://source.squeak.org/inbox/Collections-fn.847.mcz

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

Name: Collections-fn.847
Author: fn
Time: 23 July 2019, 8:08:29.343315 pm
UUID: 8d7758f5-1062-41e6-8062-7f878c2063b0
Ancestors: Collections-mt.846

Remove redundant methods for copying from Character (following Chris' suggestion at http://forum.world.st/The-Trunk-Kernel-fn-1223-mcz-tp5098738p5098777.html).

=============== Diff against Collections-mt.846 ===============

Item was removed:
- ----- Method: Character>>copy (in category 'copying') -----
- copy
- "Answer the receiver, because Characters are unique."
- ^self!

Item was removed:
- ----- Method: Character>>postCopy (in category 'copying') -----
- postCopy
- "I will never be copied"
- ^self shouldNotImplement!

Item was changed:
  ----- 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 |
- aCollection associationsDo: [ :each |
  self add: (aBlock value: each) ]!

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 isDictionary
+ ifFalse:
+ [aCollection associationsDo:
+ [ :element | self add: (aBlock value: element)]]
+ ifTrue:
+ [aCollection keysAndValuesDo:
+ [ :key :value | self at: key put: (aBlock value: value)]]!

Item was removed:
- ----- Method: Dictionary>>histogramOf: (in category 'converting') -----
- histogramOf: aBlock
-
- ^ self collect: [:assoc | aBlock value: assoc value] as: Bag!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Collections-fn.847.mcz

fniephaus


On Tue, Jul 23, 2019 at 8:08 PM <[hidden email]> wrote:
A new version of Collections was added to project The Inbox:
http://source.squeak.org/inbox/Collections-fn.847.mcz

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

Name: Collections-fn.847
Author: fn
Time: 23 July 2019, 8:08:29.343315 pm
UUID: 8d7758f5-1062-41e6-8062-7f878c2063b0
Ancestors: Collections-mt.846

Remove redundant methods for copying from Character (following Chris' suggestion at http://forum.world.st/The-Trunk-Kernel-fn-1223-mcz-tp5098738p5098777.html).

=============== Diff against Collections-mt.846 ===============

Item was removed:
- ----- Method: Character>>copy (in category 'copying') -----
- copy
-       "Answer the receiver, because Characters are unique."
-       ^self!

Item was removed:
- ----- Method: Character>>postCopy (in category 'copying') -----
- postCopy
-       "I will never be copied"
-       ^self shouldNotImplement!

Whoops...this should've been the end of the change. We'll need to split this one before merging.

Fabio
 

Item was changed:
  ----- 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 |
-       aCollection associationsDo: [ :each |
                self add: (aBlock value: each) ]!

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 isDictionary
+               ifFalse:
+                       [aCollection associationsDo:
+                               [ :element | self add: (aBlock value: element)]]
+               ifTrue:
+                       [aCollection keysAndValuesDo:
+                               [ :key :value | self at: key put: (aBlock value: value)]]!

Item was removed:
- ----- Method: Dictionary>>histogramOf: (in category 'converting') -----
- histogramOf: aBlock
-
-       ^ self collect: [:assoc | aBlock value: assoc value] as: Bag!