This is documentation for Mathematica 4, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
Wolfram Research, Inc.

Scoping ConstructsMathematical Functions

A.3.9 Ordering of Expressions

The canonical ordering of expressions used automatically with the attribute Orderless and in functions such as Sort satisfies the following rules:

FilledSmallSquare Integers, rational and approximate real numbers are ordered by their numerical values.

FilledSmallSquare Complex numbers are ordered by their real parts, and in the event of a tie, by the absolute values of their imaginary parts.

FilledSmallSquare Symbols are ordered according to their names, and in the event of a tie, by their contexts.

FilledSmallSquare Expressions are usually ordered by comparing their parts in a depth-first manner. Shorter expressions come first.

FilledSmallSquare Powers and products are treated specially, and are ordered to correspond to terms in a polynomial.

FilledSmallSquare Strings are ordered as they would be in a dictionary, with the upper-case versions of letters coming after lower-case ones. Ordinary letters appear first, followed in order by script, Gothic, double-struck, Greek and Hebrew. Mathematical operators appear in order of decreasing precedence.

Scoping ConstructsMathematical Functions