MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Intersection problem

  • To: mathgroup at
  • Subject: [mg125989] Re: Intersection problem
  • From: Alexei Boulbitch <Alexei.Boulbitch at>
  • Date: Wed, 11 Apr 2012 18:20:29 -0400 (EDT)
  • Delivered-to:

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?

Try this:

Select[{{a, x}, {b, y}, {c, z}}, MemberQ[{b, c, d}, #[[1]]] &]

{{b, y}, {c, z}}

Have fun.

Alexei BOULBITCH, Dr., habil.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG

Office phone :  +352-2454-2566
Office fax:       +352-2454-3566
mobile phone:  +49 151 52 40 66 44

e-mail: alexei.boulbitch at

  • Prev by Date: Re: Intersection problem
  • Next by Date: Deleting expressions containing a certain head
  • Previous by thread: Re: Intersection problem
  • Next by thread: Re: Intersection problem