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 2000

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

Search the Archive

Re: Sort List of Lists

  • To: mathgroup at
  • Subject: [mg24825] Re: [mg24809] Sort List of Lists
  • From: BobHanlon at
  • Date: Sun, 13 Aug 2000 23:49:48 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

In a message dated 8/13/2000 3:33:44 AM, dan_news at writes:

>Hello.  Could someone please give me a clue on how to sort a list based
>the Second Element in a List:
>I think one needs to use a "pure function" but I am too new with Mathematica
>(Trying to learn though) :>)
>For Example, I would like to sort this list based on the second element
>each sub-list in "Descending" order:
>{{9, 2}, {1, 6}, {2, 4}}
>Results would be:
>{ {1,6},{2,4},{9,2} }

Sort[theList, #1[[2]] > #2[[2]] &]

Bob Hanlon

  • Prev by Date: Re: Please help: display graph G=<V,E>
  • Next by Date: Re: Sort List of Lists
  • Previous by thread: Re: Sort List of Lists
  • Next by thread: Re: Sort List of Lists