From: Zhi-Qiang Lei Date: 2012-09-14T12:24:46+09:00 Subject: Re: inject is pathetic? Agree. #inject is essential for Array. On Sep 14, 2012, at 11:00 AM, Matt Neuburg wrote: > Dave Aronson wrote: > >> On Wed, Sep 12, 2012 at 11:46 PM, 7stud -- wrote: >> >>> Just forget inject() even exists. It's really quite a pathetic method. >> >> What do you mean by that? > > He probably just doesn't grasp how fundamental it is. After all, no one > would call "join" pathetic, but it is simply a special case of inject. > Or, to put it a better way, inject abstracts intuitively obvious notions > such as join, sum, and product. And in Ruby 1.9.3 it gets even cooler, > since you can just say: > > [1,2,3].inject(:+) > > Not everyone knows LISP or has read The Structure and Interpretation of > Computer Programs. Those who have, know. m. > > -- > matt neuburg, phd = matt@tidbits.com > A fool + a tool + an autorelease pool = cool! > AppleScript: the Definitive Guide - Second Edition! > http://www.tidbits.com/matt/default.html#applescriptthings > > Best regards, Zhi-Qiang Lei zhiqiang.lei@gmail.com