From: Rick DeNatale Date: 2009-05-15T23:10:50+09:00 Subject: Re: Whaaaaat? On Fri, May 15, 2009 at 9:30 AM, Jeff Schwab wrote: > Rick DeNatale wrote: >> >> On Fri, May 15, 2009 at 7:25 AM, Jeremy Henty >> wrote: >>> >>> On 2009-05-14, Jeff Moore wrote: >>> >>>> 1.9.1 adds  Enumerable#reduce as synonym (which makes  more sense to >>>> me) and still retains inject >>> >>> Is one of #reduce or #inject deprecated in 1.9.1? >> >> Don't think so. >> >> Actually IMHO which makes more sense is situational. > > Really?  I never heard of "inject" in any other language.  It was always > "reduce" to me.  I got the impression that "inject" was just a cutesy way of > making the method name similar to detect, select, collect, and reject. So did you stop reading my reply at that point? And if you want to let languages vote on what the 'correct' name should be maybe it should be fold: http://en.wikipedia.org/wiki/Fold_(higher-order_function)#Examples Fold gets 8 'votes', Reduce gets 7, but that's counting ruby's afterthought, and Python twice since it changed slightly between Python 2.x and 3.x so maybe that should only be 5 'votes' Inject gets 'votes' from Smalltalk and Ruby Either reduce or inject is probably the earliest though. Probably reduce since that's what Common Lisp uses, BUT CL is a tad newer than Smalltalk, and I'm not sure where in Lisp's long evolution from Lisp 1.5 reduce came into common usage. I'm a bit perturbed that I can't seem to find my copy of the Lisp 1.5 Programmers Manual which is probably buried somewhere in my attic. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale