MathGroup Archive 1996

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

Search the Archive

Re: Lists

  • To: mathgroup at smc.vnet.net
  • Subject: [mg3999] Re: Lists
  • From: rhall2 at umbc.edu (hall robert)
  • Date: Tue, 14 May 1996 02:14:23 -0400
  • Organization: University of Maryland, Baltimore County
  • Sender: owner-wri-mathgroup at wolfram.com

In article <4ms4eq$3n0 at dragonfly.wolfram.com>,
Alex Bates  <albates at ursula.uoregon.edu> wrote:
>
>	I have a two dimensional list (i.e. {{1, 23}, {2, 24}, {3, 25}, 
>{4, 26}}), and I want to remove all the first values in each pair of 
>numbers.  For instance, for the first pair, I want it to read {23}, and 
>for the second, {24} instead of {2, 24}. 
>	Any help would be greatly appreciated.

In[90]:=
  Rest[#]& /@ {{1, 23}, {2, 24}, {3, 25}, {4, 26}}
Out[90]=
  {{23}, {24}, {25}, {26}}

If you don't want the extra curly brackets, try

In[84]:=
  #[[2]]& /@ {{1, 23}, {2, 24}, {3, 25}, {4, 26}}
Out[84]=
  {23, 24, 25, 26}

You could also use Take[], Transpose[], Drop[], and Delete[].
There's probably more I haven't thought of.

-- 
Bob Hall            | "Know thyself? Absurd direction!
rhall2 at gl.umbc.edu  |  Bubbles bear no introspection."  -Khushhal Khan Khatak

==== [MESSAGE SEPARATOR] ====


  • Prev by Date: Re: AxesLabels question
  • Next by Date: Re: Do loops
  • Previous by thread: Re: Lists
  • Next by thread: Re: Lists