One more note on David's suggestion.  
I didn't really want to keep separately named subarrays around (here, a and b) and found the following variation to work.

int meta[2][0];
[0, 1, 2, 3] @=> int b[];
[10, 11, 12, 13, 14, 15] @=> int c[];
b @=> meta[0];
c @=> meta[1];

for(int j; j< meta.size(); j++)
{
    for (int i; i< meta[j].size(); i++)
        <<< " meta[", j, ",", i, "] ==", meta[j][i] >>>;
}

Regards, Dana

On Fri, Jan 7, 2022 at 10:14 AM Dana Batali <dana.batali@gmail.com> wrote:
Hey David, (mind blown).

Very interesting and useful trick!  My c++ brain didn't allow for this possibility.   Esthetically the misrepresentation of the array "shape" bothered me.   I found that I could be less bothered by changing one line and it still works!

int meta[2][0];

Thanks for playing!
Dana


On Fri, Jan 7, 2022 at 10:06 AM David Loberg Code <d.loberg.code@wmich.edu> wrote:

Dana,

I realize that this example is a 2D array, but does this workaround accomplish what you want?



int meta[2][2];


[0, 1, 2, 3] @=> int b[];

[10, 11, 12, 13, 14, 15] @=> int c[];


b @=> meta[0];

c @=> meta[1];


for (int i; i< b.size(); i++)

{ <<< " b["+i+"] ==", meta[0][i] >>>; }


for (int i; i< c.size(); i++)

{ <<< "c["+i+"] ==", meta[1][i] >>>; }



Santé,
davd

-----------------

David Loberg Code

School of Music

Western Michigan

code@wmich.edu

any pronouns





_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users