Freak Guard wrote: > I'd like to store 2d-data into an dynamic Array. The Matrix class got > the problem of being static sized and the other solution does not work: > > You can pass a block to Hash#new which gets called if the key does not > exist > >>> hsh = Hash.new {[]} > => {} >>> hsh[3] > => [] > > But this does not seem to work with Arrays... > >>> ary = Array.new {[]} > => [] >>> ary[2] > => nil > > Grettings > FreakGuard So reopen, extend, or subclass Array to get the desired behavior. What's the problem? Best, -- Marnen Laibow-Koser http://www.marnen.org marnen / marnen.org -- Posted via http://www.ruby-forum.com/.