Is there an easy way to sort a list on multiple levels of criteria?
By this I mean, first the list should be sorted according by criteria A (the same as using the usual sort function,
Sort[list, A[#1] < A[#2] & ]. I am a big fan of using the pure ordering function in Sort.). However, then I want to have elements with the same value for criterion A to be sorted within their class by criterion B. In general, I would like to do this to an arbitrary depth of criteria.
An example would be, given a set of colored blocks, first sort the blocks alphabetically by shape, then (maintaining that all the squares come before all the triangles) sort each cluster of shapes alphabetically by their colors. (Blue square, Purple square, Red square, black triangle, orange triangle, yellow triangle, etc.)