From: Gavin Sinclair Date: 2002-08-15T12:12:24+09:00 Subject: RE: Is this array operation correct? >> Then, do something like: >> >> Array.new(3).map { [] } >> >> Is there something shorter/more efficient? > > If you don't like using Array.new, you can #map to a Range: > > (1..3).map{[]} > > (Dunno about efficiency, here.) > > If you're going to map to a fresh Array, though, you may as well use the > in-place version: > > Array.new(3).map!{[]} Speaking from inexperience, I doubt there's any significant efficiency difference between the two solutions mentioned above. --Gavin