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