sort/2

Sorts a list into ascending order, removing duplicate terms

sort(List1,List2) -(i,o)

+List1 <list>

?List2 <variable> or <list>

Compatibility: LPA Win-Prolog.

This predicate sorts the list of terms in List1 into ascending order according to the standard ordering of terms, removes all duplicates, and unifies the result with List2.

Implementation note:

The internal implementation of sort/2 in G.I.S. Prolog includes hand-optimised 32-bit Assembly language code for the core of the actual sorting algorithm, after the input-terms have been converted (internally) to strings, using repeated applications of the (Visual Prolog-) predicate "term_str/3" (which is the basis of implementing the G.I.S. predicate "term_str/2", as well).