From: "Jesús Gabriel y Galán" Date: 2008-05-16T15:53:31+09:00 Subject: Re: Handling of arrays On Fri, May 16, 2008 at 8:49 AM, Jesús Gabriel y Galán wrote: > The accumulator then gets updated by > the result of the block, so the next iteration will be yielded that > value. I have realized that this sentence can be confusing: the accumulator doesn't get updated. The next value for the accumulator will be the result of the block, not necesarily the same object. I have read many times that you shouldn't use the same accumulator by applying destructive methods to it, but I can't remember what the pros and cons were. So this should not be done: irb(main):012:0> [1,2,3].inject([]) {|total,x| total << x**2} => [1, 4, 9] Instead you should do this: irb(main):013:0> [1,2,3].inject([]) {|total,x| total + [x**2]} => [1, 4, 9] Maybe someone can chime in and explain this a little bit better? Jesus.