Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: Sorting nested lists with strings

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116311] Re: Sorting nested lists with strings
  • From: Paperorbifold <kgodelNOSPAM at liberoNOSPAM.it>
  • Date: Fri, 11 Feb 2011 04:11:46 -0500 (EST)
  • References: <iitejq$jib$1@smc.vnet.net> <ij0e47$998$1@smc.vnet.net>

Sjoerd C. de Vries wrote:

> I'm not sure why you think Sort sorts on the second field of the list.
> It doesn't:
> 
> In[534]:= list = {{"Paul", 23}, {"Amanda", 5}, {"Carl", 32}};
> 
> In[535]:= Sort[list]
> 
> Out[535]= {{"Amanda", 5}, {"Carl", 32}, {"Paul", 23}}

Of course you're right! Maybe I was really tired when I sent the message.
It's clear that the option that works immediately is Sort@list (and the 
equivalent Sort[list]).
Thanks to everybody for all the answers.

-- 
...and I will make them pay for what they've done! (J.L. Picard)


  • Prev by Date: Re: list manipulation
  • Next by Date: Re: plotting a curve in 3D from data
  • Previous by thread: Re: Sorting nested lists with strings
  • Next by thread: Another point about Mathematica 8.0