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.

What I wish (though I'm not advocating an
actual change in Ruby) is to be able to
specify a default value for "new but un-
assigned" elements, much as you can give
a default value for a hash.

However, I don't want to manually keep
track of when the array gets bigger; I
don't like the option of periodically
scanning it from beginning to end; and
waiting for the array to be completely
built is not an option.

How would you recommend doing this?

Thanks,
Hal

--
Hal Fulton


Sent via Deja.com
http://www.deja.com/