substituting each item in list by an item from another list

n871's icon

Hi! Here's what I'm trying to do:

"0 1 2 3 4 5 6 7 8 9" should be replaced by for example "12 9 3 45 7 9 22 73 4 89"

so...

the list "3 5" should become "45 9"

the list "0 2 4" should become "12 3 7"

the list "8 9 8" should become "4 89 4"

etc.

Is there an object allowing lists to be converted in others with a custom mapping like this? Vexpr can't be used as the mapping doesn't contain any math. Or do I need to use unpack/pack and do it individually for each item?

Source Audio's icon

I don't understand the replacing procedure.

you want all 10 at a time, or dynamic, like replace list index(es) from 2nd list ?

also this :

the list "8 9 8" should become "4 89 4"

initial list does not have 8 9 8

Wil's icon

one way with cool

Max Patch
Copy patch and select New From Clipboard in Max.


Source Audio's icon

If Will sees it right, that you only need to extract indexes from the 2nd list

then it is even easier.

double_UG's icon

zl.lookup

Roman Thilenius's icon

exactly, lookup, the "polyphonic" version of nth.

so the task you are looking for is "store the list in a place where you can call single elements by their index."

n871's icon

Wow, thank you so much for all the replies and help, incredible! All solutions contain objects I need to check out and learn. I checked the zl object bundle so many times, I can’t believe I missed zl.lookup… thanks again!!!