Re: Sorting nested list

• To: mathgroup at smc.vnet.net
• Subject: [mg57346] Re: [mg57295] Sorting nested list
• From: János <janos.lobb at yale.edu>
• Date: Wed, 25 May 2005 06:02:53 -0400 (EDT)
• References: <200505240912.FAA19108@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```On May 24, 2005, at 5:12 AM, Gernot Pfanner wrote:

> Hi!
>
> Please forgive me, if this is the 100.000th posting concerning
> sorting a
> list. But at the moment I'm pretty confused, and so I ask you
> kindly for
> Given something like
> {{a,{2,4,1.,...}},{b,{3.2,-2,...}}}
> How do I sort just the inner lists (i.e. e.g. {2,4,1.,...}), so
> that my
> object finally looks like
> {{a,{1.,2,4.,...}},{b,{-2,3.2,...}}}
> In this spirit
> With thanks in advance
> Yours Gernot
>

In[1]:=
lst = {{a, {2, 4, 1.}},
{b, {3.2, -2}}}
Out[1]=
{{a, {2, 4, 1.}},
{b, {3.2, -2}}}

In[16]:=
({#1[[1]], Sort[
#1[[2]]]} & ) /@ lst
Out[16]=
{{a, {1., 2, 4}},
{b, {-2, 3.2}}}

János

```

• Prev by Date: Re: Applying a list of functions to a list of arguments
• Next by Date: Re: string pattern search
• Previous by thread: Sorting nested list
• Next by thread: Re: Sorting nested list