Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

RE: sort list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg47209] RE: [mg47208] sort list
  • From: "Owen, HL (Hywel)" <H.L.Owen at dl.ac.uk>
  • Date: Wed, 31 Mar 2004 02:57:10 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Sort can take many types of wildcards. One solution for you is e.g.:

In: Sort[{{A, 2}, {B, 3}, {C, 1}}, #1[[2]] < #2[[2]] &]

Out: {{C, 1}, {A, 2}, {B, 3}}

Hywel

> -----Original Message-----
> From: Guibout [mailto:guibout at ifrance.com]
To: mathgroup at smc.vnet.net
> Sent: 30 March 2004 10:02
> To: mathgroup at smc.vnet.net
> Subject: [mg47209] [mg47208] sort list
> 
> 
> Hi,
> I have a list of the form 
> {{something1,x1},{something2,x2},{something3,x3}} where x1,x2, x3 are 
> numbers. I want to sort this list with respect to xi. In 
> other word if 
> x2<x3<x1 I want Mathematica to produce:
> {{something2,x2},{something3,x3},{something1,x1}}
> Thanks for your help
> Vincent
> 


  • Prev by Date: Re: AW: Re: Music to Mathematica
  • Next by Date: Re: Expansion of an exponential expression
  • Previous by thread: Re: sort list
  • Next by thread: RE: sort list