On Apr 11, 2008, at 10:26 AM, Saku Ytti wrote: > Hey everyone, > > I was looking today for version of Array#select that would mutate > the array > by deleting selected elements from it. > I first looked at delete_if, then noticed that it actually mutates > original > array and returns mutated array. I wonder would it make sense for > delete_if > not to mutate and return new array and delete_if! to mutate and > return deleted > elements? > > Of course what I want is simple method to implement, it just seems > pretty > typical desire for Array#select usage cases and also perhaps mutating > delete_if is as well bit unexpected? Problem is, suggested change > would > break many current delete_if usage cases. a non-mutating delete_if is already there: array.select{|element| not orginal_condition(element)} ie odds = [0,1,2,3].select{|i| not i.even?} 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