From: "David A. Black" Date: 2008-03-31T00:27:58+09:00 Subject: Re: inject's pathological case... Hi -- On Mon, 31 Mar 2008, Rick DeNatale wrote: > On Sun, Mar 30, 2008 at 10:30 AM, Marc Heiler wrote: >>> Understand that it's a way to reduce/fold the elements >> > of an enumerable into a single value. >> >> Not that this is important, but personally I never liked the name >> .inject >> Though fold(l/r) is not much better either. >> >> A peculiar thing is that the wikipedia page gives "also known variously >> as " four different names as alternative/example. > > It's because the same thing has surfaced in several languages using > different terms, and those languages have in turn influenced others. > > AFAIK, Matz correct me if I'm wrong, Ruby got the name inject from > Smalltalk, along with collect, select, detect and several other > methods. The other three I mention have alias, map for collect, > find_all for select, and find for detect, but inject is still just > inject in Ruby. It picks up the synonym "reduce" in 1.9 -- which I think is kind of too bad, since inject in Ruby has such a distinctive personality and cult following :-) David -- Rails training from David A. Black and Ruby Power and Light: ADVANCING WITH RAILS April 14-17 New York City INTRO TO RAILS June 9-12 Berlin ADVANCING WITH RAILS June 16-19 Berlin See http://www.rubypal.com for details and updates!