Re: Parts of a list

• To: mathgroup at smc.vnet.net
• Subject: [mg15493] Re: Parts of a list
• From: "Donald E. Niman <niman.at.ieee.org>" <Donald at newsguy.com>
• Date: Mon, 18 Jan 1999 04:22:36 -0500
• Organization: Consultant
• References: <77jkve\$304@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```In a dream I recall that on 13 Jan 1999 21:32:14 -0500, in article
<77jkve\$304 at smc.vnet.net>, "Hossein blurted out thus...
>
>I have a list (matrix) that looks like this
>
>x={{1,0},{2.5, .5},{3,0},{0,2}}
>
>Now I want to eliminate those vectors that have zero for the second
>case. That is, I want to get
>
>{{2.5, .5},{0,2}}.
>
>Is there a quick way of doing this?
>I tried to apply Select to this but could not get it to work.
>
>
>Hossein Kazemi
>UMass
>kazemi at som.umass.edu
>
>
>

The Select function works with anonymous functions.  Anonymous functions
have two variations in syntax.  Here are some solutions using both:

x={{1,0},{2.5, .5},{3,0},{0,2}};

Select[x,(#[[2]]!=0)&]

and

Select[x,Function[y,y[[2]]!=0]]

both give the desired result.

Donald E. Niman
Peoria Arizona and Rancho Cucamonga California My opinions today do not
necessarily reflect my earlier opinions.

```

• Prev by Date: Re: list of lists
• Next by Date: Re: list of lists
• Previous by thread: Re: Parts of a list
• Next by thread: Re: Parts of a list