So, to explain the mouthful that is the question…
I’m trying to use filter, and not getting anywhere. So here’s the behaviour I want. Given a list of lists (of Integers) ie
[[1,2,3],[23456,4,3,2],[1,3,4,5,6],[3,2,1],[4,2,1],[5,6,7],[1,2,5]]
I want to take another list ie [1,2] and take all the lists that contain both those elements. (It doesn’t matter if any of the others are preserved at this moment in time, though that might be needed later). So in this example my output would be something like
[[1,2],[2,1],[2,1],[1,2]]
or preferably
[[1,2,3],[3,2,1],[4,2,1],[1,2,5]]
So you want to keep a list
candidateif all elements of the listcriterionare also elements ofcandidate. Thus yourfiltercondition iswhich, using
flipwe can write asthus giving