From: "David A. Black" Date: 2005-10-09T13:53:09+09:00 Subject: Re: bang methods Hi -- On Sun, 9 Oct 2005, Ryan Leavengood wrote: > On 10/8/05, David A. Black wrote: >> >> keep! implies keep. I think keep (without the !) would be an inplace >> operation already. Or maybe keep_all { }. > > I vote we add keep_all or keep_if, and make select! a synonym for it. > Just like delete_if and reject!. delete_if and reject! aren't quite synonyms, though: irb(main):010:0> [1,2,3,4].delete_if {|x| x > 4 } => [1, 2, 3, 4] irb(main):011:0> [1,2,3,4].reject! {|x| x > 4 } => nil I definitely like keep_if better than select! for conditional keeping, but because of the delete_if/reject! difference, one would expect keep_if (or delete_unless, maybe?) to behave like delete_if rather than like reject!. (I know this isn't a problem if select! exists too, but I'm still not in favor of that name for this functionality.) > I feel symmetry and consistency is better than sticking to ideals of > the English language. Of course I think select! makes as much sense as > reject!, so for me it is a moot point. "Ruby: the triumph of balance over symmetry" (my personal Ruby slogan :-) Not that I'm anti-symmetry -- I just like that it isn't always a determinant. David -- David A. Black dblack@wobblini.net