> Levente Uzonyi <le...@...> 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.
See the other thread
I would like to have
sameSequenceOfElements:
and sameElements:
>>
>>> #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:.
No Array are not cool. They are useful in specific ocassion.
flatCollect: and other should work on OrderedCollection, Set, SortedCollection
In Moose we have special collection like entities and they should work also on
them, and returns
the same kind of collection.
>
>>
>>> #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
>> [email protected]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
> _______________________________________________
> Pharo-project mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project