[squeak-dev] #gather appears to be working....next idiom is groupedBy:
gettimothy
gettimothy at zoho.com
Sun Oct 25 11:31:09 UTC 2020
First,
thank you for the 'gather' tip. It appears to work just fine.
Next pharo-ism is something named 'groupedBy:'
Collection >> groupedBy: aBlock
"Answer a dictionary whose keys are the result of evaluating aBlock for all my elements, and the value for each key is the selection of my elements that evaluated to that key. Uses species.
Example of use:
(#(1 2 3 4 5) groupedBy: [ :v | v odd ]) asString >>> 'an OrderedDictionary(true->#(1 3 5) false->#(2 4))'
"
This looks like 'select:' to me.
any objections/insight much appreciated.
thx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20201025/b5b6c055/attachment.html>
More information about the Squeak-dev
mailing list
|