Re: Intersection problem
- To: mathgroup at smc.vnet.net
- Subject: [mg125977] Re: Intersection problem
- From: Fred Simons <f.h.simons at tue.nl>
- Date: Wed, 11 Apr 2012 18:16:20 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201204100627.CAA10654@smc.vnet.net>
Op 10-4-2012 8:27, Cisco Lane schreef: > I need to select out the elements of the first list whose first elements are contained in the second list. For example > > first list: {{a,x},{b,y},{c,z}} > > second list: {b,c,d} > > result: {{b,y},{c,z}} > > Is there a quick way to do this? Intersection, maybe somehow? > > I am not sure if this is quick, but it is short: Pick[list1, list1[[All, 1]], Alternatives @@ list2] Regards, Fred Simons Eindhoven University of Technology
- References:
- Intersection problem
- From: Cisco Lane <travlorf@yahoo.com>
- Intersection problem