Levente Uzonyi <leves@...> writes:
#flatCollect: -> #gather: #flatCollectAsSet: -> #gather: + #asSet
NB: #gather always returns an array, should use species.
Arrays are cool, they can contain any object. And I guess #gather: + #asSet is faster than #flatCollectAsSet:.
#collect: uses species, so should #flatCollect:. This is not an issue of sets alone. When you work with your own custom collections (eg NodeList) you want all enumerations to return collections of *your* type. For the #*asSet: methods, I really do love the #*:as: solution.
keyBlock can return whatever it wants (and it doesn't have to be a block at all), PluggableDictionary >> #integerDictionary is just a dictionary that has better hash properties with integers from a small range than a normal Dictionary, but the keys don't have to be integers. Example:
'abcdefgh' groupBy: #isVowel having: [ :e | true ]
Then someone *please* fix the comment and provide #group(ed)By: without having clause. Also, again, the generated collection should be of species. When I group a node list I want node lists. --AA