Re: Delete cases nested list
- To: mathgroup at smc.vnet.net
- Subject: [mg42804] Re: Delete cases nested list
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Wed, 30 Jul 2003 04:07:30 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <bfqt01$nsu$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi, lis3 = DeleteCases[lis1, x_ /; Or @@ Flatten[Outer[SameQ, x, lis2]], {1}] Regards Jens The Leddons wrote: > > 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