Forums > MaxMSP

Filter a list

December 10, 2013 | 10:55 am

Hi everybody,

There is a way to filter a list as the following example ?

mylist = 1 2 3 6 8 9
I just want to get numbers <= 4, so :
myresultlist = 1 2 3

I think that tier can do the job, but I wondered if there is no zl function to do this in a better way ?

Thanks.


December 10, 2013 | 11:05 am

I mean tier not tier.


December 10, 2013 | 11:06 am

Ouch, auto-correction.
I mean ITER not TIER. (Sorry)


December 10, 2013 | 12:59 pm

Here’s one way..

<code>

– Pasted Max Patch, click to expand. –

</code>


December 11, 2013 | 9:19 am

Well, if you know that your list will not contain any zeros, this works:
<code>

– Pasted Max Patch, click to expand. –

</code>


December 11, 2013 | 9:42 am

zl.sect might also be of help:

<code>

– Pasted Max Patch, click to expand. –

</code>


December 11, 2013 | 10:17 am

Thank you so much guys, I will take a look and post the result asap.


December 11, 2013 | 10:20 am

Here is yet another way using iter/zl.group:

<code>

– Pasted Max Patch, click to expand. –

</code>


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