Simple question: I would like to dynamically specify a list of 3 elements, {x,y,z}
. Then I'd like to find that list, or any of its permutations, in a parent data set. The parent data set is composed of lists which are at least 3 elements long (like mine), but could also be 4 or 5 elements long. I will then be dynamically deleting the entire part which has an occurrence of x,y,z
or z,x,y
etc. from the parent data set (list of lists).
The first way I tried doesn't work for obvious reasons (I've removed Dynamic
functionality because it doesn't work anyway):
data={{0,0,0},{1,1,1},{1,2,3},{3,2,1,9}};
x=3;
y=1;
z=2;
DeleteCases[data,Permutations[{x,y,z}]]
As you can see, I want this to find and delete the 3rd and 4th elements, so that {{0,0,0},{1,1,1}}
is returned. I'd also like to update {x,y,z}
dynamically.
Are there any tricks to make this work? Or am I doing it entirely wrong? Thanks!