Forums > Max For Live

simple list comparison

June 1, 2012 | 10:38 pm

How would i do this?
If int (x) is equal to an item of the list. Output (x).
If int (x) is not equal to an item of the list. Output (x)+1

It seems zl object doesn’t have a mode that supports this??
Please save my headache!
Thanks!


June 1, 2012 | 11:54 pm

this is all I could come up with– it works but there may well be a ‘cleverer’ way:

– Pasted Max Patch, click to expand. –


Ch
June 2, 2012 | 7:39 am

you can also use vexpr for that kind of thing :

– Pasted Max Patch, click to expand. –

June 2, 2012 | 9:53 am

Regarding the question "is x element of list?" I find [zl sub] well suited.

– Pasted Max Patch, click to expand. –

June 2, 2012 | 10:25 am

Damn, 5 different ways to do this and I couldn’t think of even one of them?
I think you can tell I am more of a musician then a programmer..
Thanks a lot for the help, ‘brocs’ example looks like the least long-winded. I will go with that one.


Viewing 5 posts - 1 through 5 (of 5 total)