Re: DeleteCases : several at once, conditions
- To: mathgroup at smc.vnet.net
- Subject: [mg49395] Re: [mg49369] DeleteCases : several at once, conditions
- From: DrBob <drbob at bigfoot.com>
- Date: Sat, 17 Jul 2004 06:39:19 -0400 (EDT)
- References: <200407161006.GAA24904@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
list={{1,6,7},{3,6,9},{1,2,11},{3,5,9},{2,5,6},{2,9,11},{2,10,11},{3,7,9},{5, 8,11},{3,7,9},{7,8,9},{2,5,12},{2,6,10},{2,10,11},{1,6,9},{6,10,12},{3, 6,12},{2,5,12},{3,8,9},{1,2,7}}; DeleteCases[list,{1,_,_}|{3,_,_}] DeleteCases[list,{1,__}|{3,__}] {{2,5,6},{2,9,11},{2,10,11},{5,8,11},{7,8,9},{2,5,12},{2,6,10},{2,10,11},{ 6,10,12},{2,5,12}} {{2,5,6},{2,9,11},{2,10,11},{5,8,11},{7,8,9},{2,5,12},{2,6,10},{2,10,11},{ 6,10,12},{2,5,12}} Bobby On Fri, 16 Jul 2004 06:06:59 -0400 (EDT), camerzone <camerzone at yahoo.com> wrote: > Suppose you have a list of lists, something like > {{1, 6, 7}, {3, 6, 9}, {1, 2, 11}, {3, 5, 9}, {2, 5, 6}, {2, 9, 11}, { > 2, 10, 11}, {3, 7, 9}, {5, 8, 11}, {3, 7, 9}, {7, 8, 9}, {2, 5, 12}, > {2, 6, > 10}, {2, 10, 11}, {1, 6, 9}, {6, 10, 12}, {3, 6, 12}, {2, 5, 12}, > {3, 8, > 9}, {1, 2, 7}} > and you want to delete cases matching several different patterns, say > {1,_,_} and {9,_,_} > What's the most efficient way? > > Also, can you use conditions with DeleteCases? Say, I want to delete > all cases containing even numbers? > > tks > > -- DrBob at bigfoot.com www.eclecticdreams.net
- References:
- DeleteCases : several at once, conditions
- From: camerzone@yahoo.com (camerzone)
- DeleteCases : several at once, conditions