[chuck-users] Ragged object array

Dana Batali dana.batali at gmail.com
Fri Jan 7 13:14:50 EST 2022


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 at 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 at wmich.edu
>
> *any pronouns*
>
> ------------------------------
>
>
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20220107/716db474/attachment.html>


More information about the chuck-users mailing list