From: Rob Rypka Date: 2005-10-07T08:14:30+09:00 Subject: Re: select! not present but reject! is On 10/6/05, Yukihiro Matsumoto wrote: > In message "Re: select! not present but reject! is" > on Thu, 6 Oct 2005 06:47:35 +0900, "David A. Black" writes: > > |> Is there a reason Array#select! doesn't exist in the core? > | > |It seems like a strange concept to me. I don't associate > |destructiveness with selecting. I guess there would also be find_all! > |which seems even stranger :-) You don't watch enough reality television. The fun of selecting winners on this week's episode is rejecting everyone else. I also don't think of reject as non-destructive, but there it is. I think the exclamation paradigm overrides the subjective connotation of select and reject. Regardless of whether or not someone uses it in their own code, I doubt anyone would be confused by the meaning. Select and reject are perfect compliments. I have, on several occasions, tried to use select!, but had to rewrite them with reject! instead (not a difficult transition). As for find_all!, that's just hard to read (and hard to distinguish from find_all with many fonts), so I would never use it. Then again, find_all (regardless of its relationship to select and reject) comes off as an extension of find, and the correlating find! method would be silly (although fitting with the reality television metaphor). > That is a reason. For the same reason, we didn't implement map!, but > certain number of native speakers persuade me it was not unnatural. > Now we have map! in Array class. Same thing could happen on select!. I'll cast my vote for Array#select!, natively speaking. -- Rob (rambling with large words)