|
[Date Index]
[Thread Index]
[Author Index]
Re: Intersection problem
- To: mathgroup at smc.vnet.net
- Subject: [mg125996] Re: Intersection problem
- From: Christoph Lhotka <christoph.lhotka at fundp.ac.be>
- Date: Thu, 12 Apr 2012 02:33:40 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201204100627.CAA10654@smc.vnet.net>
hello,
here is one solution:
list1 = {{a, x}, {b, y}, {c, z}};
list2 = {b, c, d};
Select[list1, Intersection[list2, #] != {} &]
{{b, y}, {c, z}}
best,
christoph
On 04/10/2012 08:27 AM, Cisco Lane wrote:
> 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?
>
Prev by Date:
What characters are allowed in mathematica variable names? i.e. how
Next by Date:
Re: complex triple sum
Previous by thread:
Re: Intersection problem
Next by thread:
Re: Intersection problem
|