Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Sorting nested list

  • To: mathgroup at
  • Subject: [mg57361] Re: Sorting nested list
  • From: "meznaric" <meznaric at>
  • Date: Wed, 25 May 2005 06:03:11 -0400 (EDT)
  • References: <d6us0f$ivm$>
  • Sender: owner-wri-mathgroup at

You should probably use pattern matching. For example for your list:

lst = {{a, {2, 4, 1}}, {b, {3.2, -2}}};
lst//. {a___, {b_, c_List /; ! OrderedQ[c, Less]}, d___} :> {a, {b,
Sort[c]}, d}

You can basically set up a transformation rule for any such structured


  • Prev by Date: Fourier Integrals
  • Next by Date: Re: Log function
  • Previous by thread: Re: Sorting nested list
  • Next by thread: Re: Sorting nested list