pack and unpack discrete lists

artmusicsouth's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I want to combine 3 or more different items/lists and then send those into a poly~. Once inside the poly~, I then want to unpack them into their respective lists. The reason I want to do this is to get data lists that are associated with each other into the same poly~.

EDIT: These lists will be of variable length.

dtr's icon

zl lace / delace
or
zl group /slice

artmusicsouth's icon

I thought that but given that the lists contents are variable I am not sure how to implement those.

Peter Castine's icon

Before you lace or group, you could get the lengths of your lists and prepend that. Then, inside the poly~, slice off the list lengths (which I understand to be a constant length), and pass those parameters to your zl delace/slice guys.

If the number of lists itself is variable, then you'll have to prepend *that* value in front of all the others, then handle that in your poly~. You may try scripting the patcher inside your poly~ to do this, or it might be easier to hardcode a maximum number of [zl] guys. Or there are other approaches.

At this stage you might want to start looking at Javascript, or one of the other procedural languages you can talk to in Max as an alternative. Depends on what you find the most productive path to Nirvana.-)

artmusicsouth's icon

If I can get the list length that would be good. What's the best way to get that? I looked at [zl] but do not see where it outputs list length. Is there another object I should use? I want to avoid coding since I know nothing if it :)

Chris Muir's icon

zl len

I fear this may be too ambitious a project for a "cargo cult" approach

ak's icon
Max Patch
Copy patch and select New From Clipboard in Max.

@OP it seems you need a [dict]...

artmusicsouth's icon

Andrzej, BRILLIANT!!!!!

Chris Muir's icon

Just in case you missed it, I implemented a similar approach, using coll, in the other thread:
https://cycling74.com/forums/sending-midi-to-poly-problem