Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: Sorting nested lists with strings

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116289] Re: Sorting nested lists with strings
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Thu, 10 Feb 2011 05:20:37 -0500 (EST)

Since you're sorting by the first element, just write

Sort@list

or

SortBy[list,First]

Bobby

On Wed, 09 Feb 2011 01:09:52 -0600, Paperorbifold
<kgodelNOSPAM at liberonospam.it> wrote:

> I've a nested list of this kind:
> list={{"Paul",23},{"Amanda",55},{"Carl",32},...}
> Suppose I want to perform an alphabetic sort on the first element. Which  
> is
> the condition I've to write in Sort[list,...]?
> Actually Sort[list] automatically operates on the second element.
> Thanks.
>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Integrate this how?
  • Next by Date: k-permutations enumeration
  • Previous by thread: Sorting nested lists with strings
  • Next by thread: Re: Sorting nested lists with strings