In article <20020305153643.32346.qmail / web14305.mail.yahoo.com>,
Damien Joly wrote:

> The problem I forsee is that the objects would have to
> be stored in a "vector" or "array" (I think the C++
> terminology would be containers?).  Each time step
> (e.g., one year), I would iterate through the vector
> "killing" some animals (thus the vector or array of
> objects would contract), and then have the survivors
> "give birth" (thus the vector would expand). 
> Therefore, the framework that I store the objects
> would have to shrink and expand dynamically as the
> population changes.  An alternative would be to have a
> really long vector or array that never has any chance
> of filling up, but this seems to me to be a waste of
> memory.
> 
> I'm not looking for a "how-to-do-this" in any specific
> way type of answer, but rather if this dynamic array
> or vector is possible in Ruby.  I have a friend who
> programs in C and is learning C++ and he is having a
> heck of a time figuring this out.

Yes.

If you decide that an array is the right container then you can
have a look at http://www.rubycentral.com/book/ref_c_array.html 
to see the operations already available to you.

Hope this helps,

Mike

-- 
mike / stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       | GPG PGP Key      1024D/059913DA 
mike / starnix.com                   | Fingerprint      0570 71CD 6790 7C28 3D60
http://www.starnix.com/            |                  75D2 9EC4 C1C0 0599 13DA