[chuck-users] .cap() for multi-dimensional arrays
mpauley at mac.com
Wed Oct 3 11:23:59 EDT 2007
In some languages (like C) multi-dimensional arrays do need to be
rectangular. This is because it's really just one big array. i.e.
you're doing exactly the same as
except that the compiler will do a bit of sugar for you and multiply
your outer index by the inner array size and add it to your inner index.
In java this is not the case because each index into your outer array
is infact a ref to an array object.
On Oct 3, 2007, at 6:54 AM, Kassen wrote:
> On 10/3/07, Spencer Salazar <ssalazar at cs.princeton.edu> wrote:
> It makes sense when you think of multi dimensional arrays as just
> arrays of arrays. Additionally each sub-array need not be of equal
> Ah! I didn't think your could do that, I had assumed the sub-
> arrays needed to be equal length.
> In that case I withdraw my comment about the need for the index
> being ugly, obviously. In that case it's also quite coherent that
> we need ask to get the .cap() for higher dimensions in exactly that
> way but I still think a note about this in the manual couldn't hurt.
> Thanks for the demonstration!
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the chuck-users