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)