Re: Delete cases nested list
- To: mathgroup at smc.vnet.net
- Subject: [mg42785] Re: Delete cases nested list
- From: "Carl K. Woll" <carlw at u.washington.edu>
- Date: Fri, 25 Jul 2003 11:54:53 -0400 (EDT)
- Organization: University of Washington
- References: <bfqt01$nsu$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Debbie,
Here is one possibility:
In[5]:=
Cases[lis1,a_/;Intersection[a,lis2]=={}]
Out[5]=
{{2, 3, 4, 5, 6, 7, C1}, {4, 5, 6, 7, 8, 7, C4}, {23, 3, 2, 5, 6, 7, M2}}
Carl Woll
Physics Dept
U of Washington
"The Leddons" <jleddon1 at comcast.net> wrote in message
news:bfqt01$nsu$1 at smc.vnet.net...
>
> Hello,
> I have 2 lists, lis1 and lis2, I want to compare to each other for the
> purpose of deleting sublists of lis1 that have elements matching those
> in lis2. I tried this:
>
> lis1 = {{2, 3, 4, 5, 6, 7, C1}, {2, 3, 4, 5, 6, 71, B6}, {1, 2, 3, 4,
> 5, 6, C11}, {4, 5, 6, 7, 8, 7, C4}, {23, 3, 2, 5, 6, 7, M2}, {2, 3, 9,
> 5, 6, 71, B3}};
>
> lis2 = {C11, B6, B3};
>
> lis3 = DeleteCases[lis1, {x_lis2}, {2}]
>
> What I want is:
>
> lis3 = {{2, 3, 4, 5, 6, 7, C1}, {4, 5, 6, 7, 8, 7, C4}, {23, 3, 2, 5, 6,
7, M2}};
>
> However, this didn't work. Note that I want to delete all cases containing
B.
>
> Any ideas?
>
> Cheers,
>
> Debbie
>
>
>
>