Re: Re: Sorting nested list
- To: mathgroup at smc.vnet.net
- Subject: [mg57441] Re: [mg57408] Re: Sorting nested list
- From: János <janos.lobb at yale.edu>
- Date: Sat, 28 May 2005 05:39:04 -0400 (EDT)
- References: <d6us0f$ivm$1@smc.vnet.net> <200505270856.EAA07625@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On May 27, 2005, at 4:56 AM, plizak wrote: > I have a similar problem, I need to sort the same kind of list > > {{a,{2,4,1.,...}}, {c, {1,2,...}},{b,{3.2,-2,. ..}}} > > but I need to sort it based on the first element of each subarray, > while keeping the second element the same. > > I did a pretty ugly solution (like 12 lines of code). Is there a > quicker more elegant way to sort this? > In[9]:= Sort[lst, #2[[2,1]] >= #1[[2,1]] & ] Out[9]= {{c, {1, 2}}, {a, {2, 4, 1.}}, {b, {3.2, -2}}} János
- References:
- Re: Sorting nested list
- From: "plizak" <plizak@gmail.com>
- Re: Sorting nested list