There are already #pairsDo: and #pairsCollect: that could be used:

#(a b c d e f g h) pairsCollect: [ :x :y | y ] 

=> #(#b #d #f #h)

> On 19 Apr 2017, at 22:12, Tudor Girba <[email protected]> wrote:
> 
> I like this one.
> 
> Doru
> 
> 
>> On Apr 19, 2017, at 8:43 PM, Stephane Ducasse <[email protected]> 
>> wrote:
>> 
>> Hi 
>> 
>> I have 
>> 
>> #(#Object #subclass: #Point #instanceVariableNames: 'x y' 
>> #classVariableNames: '' #package: 'Kernel-BasicObjects') and I would like to 
>> select on the second elements.
>> 
>> I was thinking that 
>> 
>> #(#Object #subclass: #Point #instanceVariableNames: 'x y' 
>> #classVariableNames: '' #package: 'Kernel-BasicObjects') selectEvery: [ :i | 
>> i \\ 2 = 0 ]
>> could be a nice iterator.
>> 
>> What do you think?
>> 
>> 
>> Stef
>> 
> 
> --
> www.tudorgirba.com
> www.feenk.com
> 
> "Innovation comes in the least expected form. 
> That is, if it is expected, it already happened."
> 
> 


Reply via email to