SortBy
SortBy(list, f)
sorts
list
(or the elements of any other expression) according to canonical ordering of the keys that are extracted from thelist
’s elements usingf
. Chunks of leaves that appear the same underf
are sorted according to their natural order (without applyingf
).
Sort(f)
creates an operator function that, when applied, sorts by
f
.
Examples
>> SortBy({{5, 1}, {10, -1}}, Last){{10,-1},{5,1}}
>> SortBy(Total)[{{5, 1}, {10, -9}}]{{10,-9},{5,1}}
Implementation status
- ✅ - full supported