Ordering Functions
The function Sort uses structural rules to determine efficiently how to sort expressions. Alternative forms of order can be specified using an ordering function p in the second argument of Sort, to determine the order for each pair of expressions. Or you can use a mapping f in SortBy to modify the given expressions before deciding how to sort them.
Version 12 allows for the first time the use of both functions with the call SortBy[list, f, p]. Here is an example in which the use of an ordering function is needed after mapping a function f.
Take all points of the plane, with both coordinates being integers between 1 and 4.
If you sort them by exact norm with SortBy, the result is sorted following structural canonical order of the norms, which places integers before roots.
Use the NumericalOrder ordering function, which sorts by numerical value.