Robert Klemme <bob.news / gmx.net> wrote: > > To sum up, #sum seems too specialized. #inject is there and does the job > quite nicely - and easily. Actually, something in between would be quite nice in terms of code aesthetics. I'm thinking of the specialised but very common case of a binary accumulator and a unary function, thus (calling it 'accumulate' for want of a better name): sum = enum.accumulate(0, :+) {|x| f(x)} collect = enum.accumulate([], :<<) {|x| f(x)} and if you leave off the block, it simply applies f(x) = x. It avoids cluttering the block with the accumulator the way inject does. martin