PLOGHELP KEYSORT             Jonathan Laventhol, Tuesday 20th March 1984
                                Revised by Kathryn Seifert  October 1986

Predicate for sorting lists of terms with an arity of two

    ?- keysort(List, Sorted_list).

Keywords: compare, sort, list

'keysort' is a built in predicate for sorting lists.  It uses the
standard comparison of terms described in PLOGHELP * COMPARE.
List is expected to be a list of terms of arity two.  The elements are
sorted on their first argument.

Example:  Sort a list representing letters and their frequency, by the
frequency:

    ?- keysort([25-a, e-100, n-5, 12-o, 50-t], X).
    X = [12 - o, 25 - a, 50 - t, e - 100, n - 5]
    ?
    yes

-- RELATED DOCUMENTATION ----------------------------------------------

PLOGHELP * COMPARE
 Operators to perform metalogical comparisons on Prolog objects

PLOGHELP * SORT
 Predicate for sorting lists
