Re: Sorting nested list
- To: mathgroup at smc.vnet.net
- Subject: [mg57335] Re: [mg57295] Sorting nested list
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Wed, 25 May 2005 06:02:39 -0400 (EDT)
- Reply-to: hanlonr at cox.net
- Sender: owner-wri-mathgroup at wolfram.com
expr= {{a,{2,4,1.}},
{b,{3.2,-2,1}}};
MapAt[Sort, #, 2]&/@expr
{{a, {1., 2, 4}},
{b, {-2, 1, 3.2}}}
expr/.x_?VectorQ:>Sort[x]
{{a, {1., 2, 4}},
{b, {-2, 1, 3.2}}}
Bob Hanlon
>
> From: Gernot Pfanner <pfannerg at stud.uni-graz.at>
To: mathgroup at smc.vnet.net
> Date: 2005/05/24 Tue AM 05:12:32 EDT
> Subject: [mg57335] [mg57295] Sorting nested list
>
> 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
> your help...
> 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
>
>