====== Mathematica Tricks ====== **Sorting the elements of a list using the triple underscore pattern.** > from 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) *)