From: "ara.t.howard" Date: 2008-04-12T08:27:25+09:00 Subject: Re: delete_if, select and (lack of) delete_if!, self.POLS == false On Apr 11, 2008, at 2:40 PM, Saku Ytti wrote: > I was more thinking something along the lines > > foo = {} > ('a'..'z').each { |l| foo[l] = somearray.select {dosomething} } > > So I'd be populating foo hash, with values from somearray according > to some magic. If I'd know I only need to use each value of somearray > once, it would make sense to 'pop' the values out from the somearray > in-place. [ 'a', 'a', 'a' ].select{|x| x == 'a'} and you've clobbered.... not to mention it loses ordering. the only thing which has semantics inline with that of select is a.replace a.select(&condition) which preserves ordering and allows for duplicates. cheers. a @ http://codeforpeople.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama