From: Trans Date: 2006-12-08T06:03:31+09:00 Subject: Re: [GOLF]: partitioning an array ara.t.howard@noaa.gov wrote: > On Thu, 7 Dec 2006, Martin DeMello wrote: > > > On 12/7/06, Robert Klemme wrote: > >> Hash.new {|h,k| h[k]=[]} > > > > This is common enough that it deserves to be its own constructor, imo > > - Hash.multi perhaps > > my own lib has > > def Hash.list list_class = Array, *a, &b > Hash.new {|h,k| h[k] = list_class.new(*a, &b)} > end def Hash.new_by(o='[]') Hash.new {|h,k| h[k] = eval o} end Hash.new_by '[]' T.