From: Michael Neumann Date: 2008-08-01T16:28:35+09:00 Subject: [ruby-core:18046] Re: New array methods cycle, choice, shuffle (plus bug in cycle) Gregory Brown wrote: > On Thu, Jul 31, 2008 at 7:50 PM, Yukihiro Matsumoto wrote: >> Hi, >> >> In message "Re: [ruby-core:18036] Re: New array methods cycle, choice, shuffle (plus bug in cycle)" >> on Fri, 1 Aug 2008 08:33:15 +0900, Charles Oliver Nutter writes: >> >> |choice is a noun. choose, map, select, collect, etc are imperative >> |verbs. So choose much more consistent with the others. Also, choice >> |implies to me that it's already been made...since you can't have a >> |choice unless you've already made a "choice". In essence, a "choice" is >> |the product of "choosing" something. So ary.choose produces a choice. >> >> Interestingly Python chose "choice" for the method. Does anyone have >> any additional info? > > If feel like this sort of makes sense: > > a = [1,2,3].choose > > a is some element of [1,2,3] that Array has chosen for me. > > But in my mind, > > a = [1,2,3].choice For me as a non-native English speaker, #choice is clearer. For me, #choose implies that *I* have to choose something, i.e. I would expect that method #choose has a parameter, which it doesn't have. Whereas #choice implies, that I have no choice, which is in some sense true for this method, because I can't choose the element I want. So in contrast to Charles, I think, ary.choice produces a choose operation internally :) > Doesn't seem very clear. Mostly for the same reasons Charlie suggested. > > I still think > > a = [1,2,3].rand Yes, I like this even more. Regards, Michael