Sorts elements of a list according to a function.
SortBy[list, f]
SortBy[list, {f1, f2, …}]
SortBy[list, f, p]
SortBy[f]
SortBy[{3, 1, 2}, # &]
→ {1, 2, 3}SortBy[{1, 2, 3, 4}, {Mod[#, 2] &, # &}]
→ {2, 4, 1, 3}SortBy[{{1, 2}, {3, 1}, {2, 5}}, Last, Greater]
→ {{2, 5}, {1, 2}, {3, 1}}