From: Logan Capaldo Date: 2007-08-25T11:04:16+09:00 Subject: Re: Combining Array Elements Yet another variation on the theme: def foo(a) a.inject(Hash.new(0)) { |h, (k1, k2, v)| lambda { |k| h.update(k=>h[k]+v) }[[k1,k2]] }.map { |k, v| k + [v] } end