I have two lists, for example
s={{1,3,2},{1,3,2},{2,3,1},{3,1},{2,3,1}};
c={{3},{1,2},{3}};
First element of c
means that number 1 from s[[3]]
must be deleted. Number is a position of this element in c
.
Second element of c
: delete number 2 from s[[{1,2}]]
.
Third: delete number 3 from s[[3]]
The result must be
(* {{1,3},{1,3},{2},{3,1},{2,3,1}} *)
Another example
s={{2,1,3},{2,3,1},{1,2,3},{2,3}};
c={{1},{2,4},{3}};
(* {{2,3},{3,1},{1,2},{3}} *)
One more question. Also two lists:
s={{{1,3},{1,2},{3,2},{1},{3},{2}},
{{1,3},{1,2},{3,2},{1},{3},{2}},
{{1},{2},{3}},
{{3},{2},{1}}};
c={{3},{1,2},{}};
So, from s[[3]]
(* {{1},{2},{3}} *)
it's necessary to delete ALL elements which contain number 1: {1} (* {{2},{3}} *)
From s[[{1,2}}]]
- all elements which contain number 2
(* {{{1,3},{1},{3}},
{{1,3},{1},{3}},
{{2},{3}},
{{3},{2},{1}}} *)
How can I do it?