From: Brian Candler Date: 2012-09-13T16:42:23+09:00 Subject: Re: Breaking Down the Block Sung Pae wrote in post #1075726: > On Thu, Sep 13, 2012 at 12:46:23PM +0900, 7stud -- wrote: > >> Just forget inject() even exists. It's really quite a pathetic method. > > inject is just reduce/foldl from other languages. It is just sugar for > building an accumulator in a foreach loop, but it has a long history. It's also a baby step towards "functional programming" - realising that you don't actually need mutable variables to do useful computation, which in turn frees you from certain kinds of programming logic errors. I really like how Ruby lets you do things like this on a small scale, without having to go full-out functional. -- Posted via http://www.ruby-forum.com/.