On Thu, Apr 20, 2017 at 3:17 AM, Stephane Ducasse <[email protected]> wrote:
> 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
