From: Pit Capitain Date: 2006-11-15T17:38:04+09:00 Subject: Re: Design problem with 'inject' Gary Boone schrieb: > The real problem is that 'inject' has two semantics: 1) it adds onto sum > using an explicit "sum +=" or 2) is adds the value of the block. Gary, that's not true. The version of inject you use (with an explicit initial value for the accumulator) works as follows: def my_inject(initial_value) accumulator = initial_value self.each do |element| accumulator = yield(accumulator, element) end accumulator end The result of the block simply becomes the next value of the accumulator. Regards, Pit