From: "ara.t.howard" Date: 2008-04-12T05:31:19+09:00 Subject: Re: delete_if, select and (lack of) delete_if!, self.POLS == false On Apr 11, 2008, at 2:07 PM, Saku Ytti wrote: > I see what you mean, and I fully agree that changing existing > methods would cause lot of inconvenience. Kinda just wish this > functionality would be built-in (for performnce reasons), and > select!, reject!, delete_if! might be feasible candidates from > different points of view, if there wasn't history as a burden. > Anyhow than you for your insight. think about that [0, 1, 2, 3].reject!{|i| i.odd} is going to do mutiple array replacements, so [0,2,3] [0,3] shuffling an array like that all the way would KILL performance. you need to build a new array and then replace all at once. of course that is already there a.replace a.select{|i| i.odd?} which reads clearly and doesn't degrade to exponential array shuffling... food for though 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