Skip to main content

SortBy

SortBy[list,f] sorts the elements of list in the order defined by applying f to each of them. 

SortBy[list,{f1,f2,…}] breaks ties by successively using the values obtained from the fi.

SortBy[list,f,p] sorts the elements of list using the function p to compare the results of applying f to each element.

SortBy[f] represents an operator form of SortBy that can be applied to an expression.

Please visit the official Wolfram Language Reference for more details and examples on core symbols.