From: "Hal E. Fulton" Date: 2000-12-16T13:02:30+09:00 Subject: [ruby-talk:7389] Re: Replacing nils in arrays? ----- Original Message ----- From: hipster To: ruby-talk ML Sent: Friday, December 15, 2000 12:48 AM Subject: [ruby-talk:7302] Re: Replacing nils in arrays? > On Fri, 15 Dec 2000 07:40:01 +0900, hal9000@hypermetrics.com wrote: > > Question for you all. > > > > Suppose you have an array that is growing > > more or less unpredictably. You assign an > > element that is past the current end, and > > you get several new nils as a result. > > > > My problem: I want to store zeroes, not > > nils. > > quick hack: > > > class Array > attr_accessor :default_value > [snip] Quite right. Thanks Michel (and others who responded). I ended up subclassing Array and doing much this same thing. Hal