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

 Further Examples: Sort You can put a list of letters into canonical order. In[1]:= Out[1]= The expression to be sorted need not have head List. In[2]:= Out[2]= Both of these commands sort the list from largest to smallest. In[3]:= Out[3]= In[4]:= Out[4]= Here numbers with a smaller square come before those with a larger square. In[5]:= Out[5]= This sorts pairs lexicographically: {x, y} comes before {w, z} if x < w, or if x == w and y < z. In[6]:= Out[6]= Here is another example. In[7]:= Out[7]= Exact numbers are not sorted according to their magnitude by defaultthat would be too slow. In[8]:= In[9]:= Out[9]= In[10]:= Out[10]= Rather, expressions are usually ordered by comparing their parts in a depth­first manner. The first elements that occur at level determine the ordering here. In[11]:= Out[11]= This defines the function sortBy which sorts the list according to the values of f of the elements of list. In[12]:= Here are five dimensional vectors. In[13]:= Out[13]= Here are the vectors sorted by norm. In[14]:= Out[14]= Sort puts z10 before z2 because 1 comes before 2. In[15]:= Out[15]= Unlike Sort, the function noDigitsSort ignores digits in variable names. In[16]:= In[17]:= In[18]:= Out[18]= In[19]:=