Re: Why Sort[{"AX", "!D", "EX"}] -> {"AX", "!D", "EX"} ?
- To: mathgroup at smc.vnet.net
- Subject: [mg75994] Re: Why Sort[{"AX", "!D", "EX"}] -> {"AX", "!D", "EX"} ?
- From: Szabolcs <szhorvat at gmail.com>
- Date: Mon, 14 May 2007 03:53:08 -0400 (EDT)
- Organization: University of Bergen
- References: <f26nv5$4cl$1@smc.vnet.net>
Philipp wrote: > Would anybody explain to me the Mathematica (5.2) canonical order. > Specifically, why > > In[]:= Sort[{"AX", "!D", "EX"}] > Out[]= {"AX", "!D", "EX"} > > while, > > In[]:= Sort[{"A", "!", "E"}] > Out[]= {"!", "A", "E"} > > Is this a bug??? > > Cheers, > > Philipp. > > http://documents.wolfram.com/mathematica/book/section-A.3.9 Most probably it has to do something with the "Mathematical operators appear in order of decreasing precedence." part. This behaviour is too consistent to be a bug (i.e. unintended behaviour), but it is really confusing. The documentation only mentions the ordering of single characters, but not how longer strings are treated, and it seems that it doesn't work as most people would expect it to.
- Follow-Ups:
- Re: -> {"AX", "!D", "EX"}
- From: dimitris <dimmechan@yahoo.com>
- Re: -> {"AX", "!D", "EX"}
- From: "Szabolcs Horvát" <szhorvat@gmail.com>
- Re: Re: Why Sort[{"AX", "!D", "EX"}] -> {"AX", "!D", "EX"}
- From: Murray Eisenberg <murray@math.umass.edu>
- Re: -> {"AX", "!D", "EX"}