[Pharo-project] Collection extensions

Gary Chambers gazzaguru2 at btinternet.com
Mon Jan 5 13:28:25 EST 2009


In a similar vein, one I have found useful with the Report Builder for 
enablement of toolbar buttons/menu options in a multiple selection case:

isHomogeneous: aBlock
 "Answer whether the result of evaluating the given
 block for each element of the receiver has the same
 value in each case."

 |val|
 self ifEmpty: [^true].
 val := aBlock value: self anyOne.
 ^self allSatisfy: [:e | (aBlock value: e) = val]

Regards, Gary.

----- Original Message ----- 
From: "Alexandre Bergel" <alexandre at bergel.eu>
To: <Pharo-project at lists.gforge.inria.fr>
Sent: Monday, January 05, 2009 6:02 PM
Subject: Re: [Pharo-project] Collection extensions


>+ 1
>
> On 5 Jan 2009, at 14:53, Gary Chambers wrote:
>
>> Can't remember the number of times I've had to implement these kinds
>> of
>> generally useful methods on various Smalltalk dialects (particularly
>> #groupedBy:, called it #categorizedBy: myself ;-) ). Really should
>> be part
>> of all Smalltalks. I'd push for general adoption/standardisation for
>> every
>> dialect! That's the only way Smalltalk is going to evolve, the "ANSI
>> standard" is years behind!
>>
>> Regards, Gary.
>>
>>>
>>> So why do we do pharo. Really. If everything as to be compatible with
>>> other
>>> smalltalk. Terrible.
>>> Can't we get smarter?
>>> Why can't we tag the methods with <notAnsi> and build a tool that
>>> check when you
>>> do a fill out. I do not write code to be portable to VisualWorks so?
>>>
>>>> I would prefer to have such extension methods separate from the
>>>> core.
>>>
>>> Me not. Because then in a lot of places I will have to inline their
>>> body.
>>>
>>> Stef
>>>
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> Pharo-project at lists.gforge.inria.fr
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> Pharo-project at lists.gforge.inria.fr
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
> -- 
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
>
>
> _______________________________________________
> Pharo-project mailing list
> Pharo-project at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project 





More information about the Pharo-dev mailing list