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.
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.
On Thu, Jan 13, 2011 at 1:59 AM, Edmond K. < [email protected]> wrote:
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 P. and Rein H.
were
giving their presentations simultaneously, in different rooms, and both
of
them criticized the use of this method
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 P. and Rein H. were
giving their presentations simultaneously, in different rooms, and both of
them criticized the use of this method
Note that Iverson’s notation in “A Programming Language”(Wiley, 1962)
contained “reduction” operations to extend an operation such as
multiplication over all components of a vector or matrix. APL
programmers commonly pronounce an expression like “+/v” as “plus reduce
v”.