From: Joel VanderWerf Date: 2005-11-23T13:58:01+09:00 Subject: Re: what is the ruby way to do this? David A. Black wrote: > Hi -- > > On Wed, 23 Nov 2005, Jeff Wood wrote: > >> I would do >> >> a = Hash.new { || [] } > > > I believe that's the first empty || I've ever seen. It's awfully > confusing (my first reaction was: *what* or an empty array? :-) I'd > strongly encourage you to eschew that construct. It's deservedly > unheard of :-) It's not completely useless: irb(main):001:0> noargs = proc { || 3 } => # irb(main):002:0> noargs[] => 3 irb(main):003:0> noargs[2] ArgumentError: wrong number of arguments (1 for 0) from (irb):3 from (irb):3 -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407