From: Robert Dober Date: 2008-04-12T04:04:30+09:00 Subject: Re: delete_if, select and (lack of) delete_if!, self.POLS == false On Fri, Apr 11, 2008 at 7:31 PM, Saku Ytti wrote: > On (2008-04-12 02:26 +0900), Saku Ytti wrote: > > > class Array;def reject!(&blk) > > reject(&blk).each{|e|delete e};end > > def select!(&blk) > > select(&blk).each{|e|delete e};end;end > > Actually just inside out, reject! should be select(&blk) > and select! should be reject(&blk). > No, not quite x=[*0..1] x.select{|n| n.even?} -> [0] x -> [0,1] x.reject!{|n| n.odd?} -> [0] x -> [0] Cheers Robert > -- > ++ytti > > -- http://ruby-smalltalk.blogspot.com/ --- Whereof one cannot speak, thereof one must be silent. Ludwig Wittgenstein