sortOn package:data-ordlist

The sortOn function provides the decorate-sort-undecorate idiom, also known as the "Schwartzian transform".
This variant of sortOn recomputes the sorting key every comparison. This can be better for functions that are cheap to compute. This is definitely better for projections, as the decorate-sort-undecorate saves nothing and adds two traversals of the list and extra memory allocation.
The nubSortOn function provides decorate-sort-undecorate for nubSort.
This variant of nubSortOn recomputes the sorting key for each comparison