[Pharo-dev] In the quest of a new iterator :)

Ben Coman btc at openinworld.com
Thu Apr 20 11:06:22 EDT 2017

On Thu, Apr 20, 2017 at 3:17 AM, Stephane Ducasse <stepharo.self at gmail.com>

> why?
> Iterators are powerful and avoid that we all reinvent the wheel in our own
> corners.
> About keySelect: I do not see the point to convert a large collection into
> a dictionary then do yet another pass.
> To me it looks like a hack.
> I implemented
> selectEvery:
> (selectFirst selectSecond) as helpers.
> and also unzip all in one pass.
> Now I have no problem to keep them for me but to me this is the wrong
> attitude.
> Stef
> testSelectEveryFirst
> self assert: (#(#Object #subclass: #Point #instanceVariableNames: 'x y'
> #classVariableNames: '' #package: 'Kernel-BasicObjects') selectEveryFirst)
> asArray equals: #(#Object #Point 'x y'  '' 'Kernel-BasicObjects')

selectEveryFirst seems a strange name, not indicating the skip amount.
The first of every three? or four?  As it stand, technically I'd think its
result would
be equals: (#(#Object #subclass: #Point #instanceVariableNames: 'x y'
#classVariableNames: '' #package: 'Kernel-BasicObjects')

+1 to Peter's suggested #withIndexSelect:

cheers -ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20170420/20134a21/attachment-0002.html>

More information about the Pharo-dev mailing list