From: "Jesús Gabriel y Galán" Date: 2010-01-26T06:40:44+09:00 Subject: Re: Nested hash with arrays for default value On Mon, Jan 25, 2010 at 10:28 PM, Gary Wright wrote: > > On Jan 25, 2010, at 2:24 PM, Glen Holcomb wrote: >> >> I'll play around with your solution.  I have the following: >> >> data = Hash.new { |l, k| l[k] = Hash.new { |l, k| l[k] = Hash.new { |l, k| >> l[k] = Hash.new([]) }}} > > I'm assuming you want 'infinite' depth.  Consider: > > default = lambda { |h,k| h[k] = Hash.new(&default) } > top = Hash.new(&default) The problem is that he wants the leaves of the hash to be arrays, and not hashes. Jesus.