Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #9568 > unrolled thread

Re: Intersection problem

Started byBill Rowe <readnews@sbcglobal.net>
First post2012-04-11 22:25 +0000
Last post2012-04-11 22:25 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: Intersection problem Bill Rowe <readnews@sbcglobal.net> - 2012-04-11 22:25 +0000

#9568 — Re: Intersection problem

FromBill Rowe <readnews@sbcglobal.net>
Date2012-04-11 22:25 +0000
SubjectRe: Intersection problem
Message-ID<jm50cc$2pr$1@smc.vnet.net>
On 4/10/12 at 2:27 AM, travlorf@yahoo.com (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?

In[1]:= Cases[{{a, x}, {b, y}, {c,
   z}}, _?(Intersection[#, {b, c, d}] != {} &)]

Out[1]= {{b, y}, {c, z}}

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web