< Back to IRCAM Forum

Filter sublists by list of items

Hi all,

Sorry to trouble you again so soon after my most recent post. I’m trying to process a large list of pitch sets down to something more manageable, without having to do everything by hand.

I have a list containing multiple sublists, and a separate list of pitches (i.e. a filter) which I don’t want present in my eventual output. I need to filter out any sublists from the first list which contain any pitches from the second list, but can’t work out how to do this without much looping… is there by any chance a more elegant solution? Thanks again for all your help.

Sam

To clarify:

List 1
((8650 8450 8250 8600 8050) (8650 8150 8250 8600 8050) (8650 7900 8250 8600 8050) (8650 8000 8100 8000 8050))

List 2 (Filters)
(8150 7900)

In the above example, only the first & last sublists would pass, my output being ((8650 8450 8250 8600 8050) (8650 8000 8100 8000 8050)).

Hi Sam,

This is one solution (cf. attachment)
Best
K

filter_sub.omp (3.84 KB)

Thanks Karim! Much more elegant than another solution I came up with; the combination of x-intersect & ‘not’ function looks very useful indeed.