[chuck-users] arrays holding arrays?

Kassen signal.automatique at gmail.com
Fri Aug 4 16:02:01 EDT 2006

Sorry, but I'd like to go into a little more depth because this turns out
not to function as I expected.

I folowed this;

You should be able to do this using a two dimensional array:
>      int memory[8][32];
> You can treat this as a matrix or as an array of array.  To get the 0th
> array:
>      memory[0]
> Should be of type int []:
>      memory[0] @=> int array[];

And up till here it works.

Now I store array[] in memory like this;

array @=> memory[0];

That works. Now I make array change based on keyboard input (programing
beats in my case). suppose now I'd like to go back to the last stored state.
For this I go;

memory[0] @=> array;

Which I expected to recall my last stored version of the array but in fact
it doesn't; this seems to keep "array" identical to what it was. Other
things go wrong as well, particularly; I programed some beats (meaning I
tured array into something interesting), stored them in memory[0], then made
a variation in memory[1], did that again for memory[2]. At that point trying
to recall what was in memory[0] results in getting data identical to what is
in memory[2] (and so identical to array as well).

I believe this to be because I think I'm creating a link between the array
and a section of memory while what I'd like to do is copy data from the
array to the "memory" where I'd like it to stay the same untill I tell it to

So... Now what? Copy all numbers one by one? perhaps there is some special
syntax or way of unlinking the reference while keeping the data?

Hope this is at least somewhat clear?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20060804/a19a1b49/attachment.htm 

More information about the chuck-users mailing list