This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.

# Sort

 Sort[list]sorts the elements of list into canonical order. Sort[list, p]sorts using the ordering function p.
• Sort by default orders integers, rational and approximate real numbers by their numerical values.
• Sort orders complex numbers by their real parts, and in the event of a tie, by the absolute values of their imaginary parts.
• Sort orders symbols by their names, and in the event of a tie, by their contexts.
• Sort usually orders expressions by putting shorter ones first, and then comparing parts in a depth-first manner.
• Sort treats powers and products specially, ordering them to correspond to terms in a polynomial.
• Sort orders strings as in a dictionary, with upper-case versions of letters coming after lower-case ones. Sort places ordinary letters appear first, followed in order by script, Gothic, double-struck, Greek and Hebrew. Mathematical operators appear in order of decreasing precedence.
• Sort[list, p] applies the function p to pairs of elements in list to determine whether they are in order. The default function p is OrderedQ[{#1, #2}]&.
• Sort can be used on expressions with any head, not only List.
Sort a list:
 Out[1]=

Sort using Greater as the ordering function:
 Out[1]=
 Out[2]=

Sort by comparing the second part of each element:
 Out[1]=
 Scope   (3)
 Applications   (5)
New in 1