On Sun, 27 Dec 2009, Adrian Kuhn wrote:
Levente Uzonyi <leves@...> writes:
#equalsTo: misleading name, #containsSameElementsAs: would be better IMO #(1 1 2) equalsTo: #(2 1 1) ===> true
There is a #sameElements: in roel typer package. I think #sameElementsAs: and #sameSequenceAs: would be nice method names for methods that test for same elements and same elements in same order.
#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:.
#groupBy: -> #groupBy:having:
Does not have the same behavior! #groupBy:having: requires that "keyBlock should return an Integer" whereas #groupedBy: works with any values (except nil) returned from the the block.
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 ]
#sum: -> #detectSum:
Short names and readability, anyone? Also the name is misleading, #detect: returns an element of the collection, #detectSum not. For maximum it makes sense to have both #detectMax: (which returns the element with the max value) and #max: (which returns the max value).
I agree that the name is wrong, but it's in the base image.
SequenceableCollection >> #shuffle -> #shuffled
NB: #shuffledBy: should use `i atRandom:` rather than `(1 to: i) atRandom:` to avoid creating an interval object for each element of the collection.
I fixed that in squeak in october and I found the fix in my 1.1 pharo image, though further improvement is possible (even ~85% speedup can be achieved :)). Levente
OrderedCollection >> #removeAtIndex: -> #removeAt:
Shorter name, nice! :)
--AA
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project