Key-Value
,
that is, terms whose principal functor is (-)/2, whose first argument is
the sorting key, and whose second argument is the satellite data to be
carried along with the key. keysort/2
sorts List like msort/2,
but only compares the keys. Can be used to sort terms not on standard
order, but on any criterion that can be expressed on a multi-dimensional
scale. Sorting on more than one criterion can be done using terms as
keys, putting the first criterion as argument 1, the second as argument
2, etc. The order of multiple elements that have the same Key
is not changed.
<
, const>
or
=
. If built-in predicate compare/3
is used, the result is the same as sort/2.
See also keysort/2. (30)