The Inbox: Collections-eem.803.mcz

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

The Inbox: Collections-eem.803.mcz

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

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

Name: Collections-eem.803
Author: eem
Time: 21 August 2018, 2:09:17.558296 pm
UUID: 86665c06-0176-4eb8-b9dd-2b8dc3677fd6
Ancestors: Collections-dtl.802

More rational Dictionary>>fillFrom:with: so that collect:as: Dictionary matches e.g. Dictionary withAll:

Since 2010 Dictionary withAll: { 2->3 } =>  a Dictionary(2->3 ).
But
'abc' collect: [ :each | each -> each asciiValue ] as: Dictionary => a Dictionary(1->$a->97 2->$b->98 3->$c->99 )

With this change no tests appear to break (at least none that explicitly call collect:as:) and
'abc' collect: [ :each | each -> each asciiValue ] as: Dictionary => a Dictionary($a->97 $b->98 $c->99 )

=============== Diff against Collections-dtl.802 ===============

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