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


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

Re: Intersection problem

From Bill Rowe <readnews@sbcglobal.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Intersection problem
Date 2012-04-11 22:25 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jm50cc$2pr$1@smc.vnet.net> (permalink)

Show all headers | View raw


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}}

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web