simple list comparison

Jun 1, 2012 at 10:38pm

simple list comparison

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!

#56441
Jun 1, 2012 at 11:54pm

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

– Pasted Max Patch, click to expand. –
#202401
Jun 2, 2012 at 5:54am

Hello,

another way with [zl unique] …

– Pasted Max Patch, click to expand. –

… could use [zl filter] too.

#202402
Jun 2, 2012 at 7:39am

you can also use vexpr for that kind of thing :

– Pasted Max Patch, click to expand. –
#202403
Jun 2, 2012 at 9:53am

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

– Pasted Max Patch, click to expand. –
#202404
Jun 2, 2012 at 10:25am

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.

#202405

You must be logged in to reply to this topic.