MathGroup Archive 2003

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

Search the Archive

Re: more with lists

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40350] Re: [mg40326] more with lists
  • From: Tomas Garza <tgarza01 at prodigy.net.mx>
  • Date: Wed, 2 Apr 2003 04:37:03 -0500 (EST)
  • References: <C3A16B6A-6334-11D7-B455-00039311C1CC@mimuw.edu.pl> <200303310901.EAA21697@smc.vnet.net> <200304010952.EAA00092@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Suppose

In[1]:=
lst = Table[{Random[Integer, {0, 9}], Random[Integer,
      {0, 9}]}, {100}];

In[2]:=
x0 = 3; y0 = 2;

The two obvious ways are

In[3]:=
Cases[lst, {x_, y_} /; x < x0 && y > y0]

In[4]:=
Select[lst, #[[1]]<x0&&#[[2]]>y0&]

Tomas Garza

Mexico City
----- Original Message -----

From: "Nathan Moore" <nmoore at physics.umn.edu>
To: mathgroup at smc.vnet.net
Subject: [mg40350] [mg40326] more with lists


> The replies have been beautiful!
>
> suppose I have a list of n {x,y}pairs.  I'd like to cull the list into a
> smaller list for which the condition x<Xo, y>Yo is true.  If the list was
> 1-D I could simply use "Select," how do I access the data points in pairs?
>
> Nathan Moore
> Universoty of Minnesota Physics
>
>
>




  • Prev by Date: RE: more with lists
  • Next by Date: Re: multistep iterative methods
  • Previous by thread: more with lists
  • Next by thread: Re: more with lists