Re: Sorting nested list
- To: mathgroup at smc.vnet.net
- Subject: [mg57374] Re: Sorting nested list
- From: dh <dh at metrohm.ch>
- Date: Thu, 26 May 2005 04:31:19 -0400 (EDT)
- References: <d6us0f$ivm$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Gernot, MapAt will apply a function exactly at the places you choose.E.g.: d = {{a, {2, 4, 1.}}, {b, {3.2, -2, -3}}}; MapAt[Sort, d, Table[{i, 2}, {i, 1, Length[d]}]] You may also use Map and take the arguments apart: {First[#], Sort[Rest[#]]} & /@ d Sincerely, Daniel 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 > 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 >