[ Comparing and Sorting | Reference Manual | Alphabetic Index ]
Succeeds if List2 is the numerically ordered version of List1.
- List of numeric terms.
- List of numeric terms or variable.
List1 is sorted according to numerical ordering, and unified with List2.
The sort is done according to numerical ordering and duplicates are
retained as opposed to sort/2 which uses the standard ordering of
terms and removes duplicates. See sort/4 for a discussion of the
differences between numerical and standard ordering of numeric types.
number_sort(L1,L2) is equivalent to sort(0,$=<,L1,L2).
Modes and Determinism
- (4) instantiation fault
- List1 is not ground.
- (5) type error
- List1 contains non-numeric elements.
sort([3,1,6,7,2],S). (gives S=[1,2,3,6,7]).
sort([1,3,2,3,4,1],S). (gives S=[1,1,2,3,3,4]).
sort / 2, msort / 2, sort / 4