--0016e64f9170c7421e0499b8a36b
Content-Type: text/plain; charset=ISO-8859-1

On Thu, Jan 13, 2011 at 1:59 AM, Edmond Kachale <
edmond.kachale / baobabhealth.org> wrote:

> Rubysters,
>
> I often use inject method (where and when I want to. Lol!). I would like to
> know the difference between inject and reduce methods. I find them similar.
>
> Ref: http://www.ruby-doc.org/core/classes/Enumerable.html#M001495
>
> ---
> Edmond
> Software Developer | Baobab Health Trust (http://www.baobabhealth.org/) |
> Malawi
>
> Cell:  +265 999 465 137 | +265 881 234 717
>
> *Prosperous New Year 2011 and Prosperous New Decade!!*
>


They are the same, I think the names are just to make people from different
languages feel at home. I think "inject" is from Smalltalk, and "reduce" is
from Common Lisp, and IIRC "fold" is from Scheme and Haskell.

Interestingly, at the last RubyConf, Aaron Patterson and Rein Henrichs were
giving their presentations simultaneously, in different rooms, and both of
them criticized the use of this method :P

--0016e64f9170c7421e0499b8a36b--