< Back to IRCAM Forum

Multiplying elements between two lists

This must be a stupid question but I couldn’t find an object to do that. How can I multiply elements from list A with elements from list B preserving their position?

(0, 1, 2, 3, 4) * (a, b, c, d, e)

result --> (0a, 1b, 2c, 3d, 4e)

Is there a single object to do that?

HI,

Just simply use the om* method. It will do exactly this !

Best
K

I knew this was a stupid question! lol

Thank you very much, Karim

Best

Kant

Hey common’ Kant,

It is not that stupid… It’s just a beginner’s question and it’s OK…!

Try this :

  • Double click on om*

You’ll see 4 icons. These are what we call “methods” that the multiply (or plus) operation can handle.
So if you use one num against another, it’s simply *
THen if you use a num and a list, the om* method, “intelligently” :slight_smile: will add the num to all elmts of the list.
Now if you use, 2 lists, it will do what you were looking for.
But , as intelligent as it is this method, will ONLY add or * or whatever, between 2 list of the same lgth. If one list is bigger, then it will “stupidly” ( :wink: ) ignore the rest of it…

Well this is how methods works.
Keep exploring and you will see it’s not that difficult. And if you have other questions, go on and ask them…!

BEst !
K