From: Michel Demazure Date: 2011-11-23T20:23:31+09:00 Subject: [ruby-core:41248] Re: [ruby-trunk - Feature #5662] inject-accumulate, or Haskell's mapAccum* Benoit Daloze wrote : > h = {} > [1, 2].each { |i| h[i] = 2*i } > h > > I believe the code I showed is somewhat common in 1.9 and is clear to people knowing about it. I would write Hash.new.tap do |h| ... end Heavier, but the intention is clearer, and without an extra variable (outside of the block). _md