Sorting the elements of a list using the triple underscore pattern.
from <Power Programming with Mathematica: The Kernel> by D.B. Wagner.
sorter[{a___, b_, c_, d___} /; b > c] := sorter[{a, c, b, d}] sorter[x_] := x (* Usage Example: *) sorter[{5, 2, 7, 1, 4}] (* {1, 2, 4, 5, 7) *)