From: daz Date: 2005-11-25T23:22:28+09:00 Subject: Re: Faster way to pick the every other array member? Damphyr wrote: > we have [1,2,3,4,5,6,7] and want [2,4,6] > ( A more general version of Simon's: f=true; p a.select{f=!f} ): #-------- ix=-1; p a.select{ (ix+=1)%2==1 } #-> [2, 4, 6] #-------- (Not pretty ... not my fault) I would prefer not having to maintain the index in these situations. Something like this would suit many similar needs: p a.select{ _i_%2==1 } - where _i_ (or whatever) is the index that Ruby is using internally. daz