compare/3
compare(
-Order, +Term1, +Term2)
succeeds if the result of comparing terms Term1 and Term2 is Order
[<,=,>]
=
<
>
The standard total order is as follows. For further details see ref-lte-cte-sot.
variables@<
database references@<
numbers@<
atoms@<
compound terms
The goal (A) is equivalent to (B):
| ?- compare(=, Term1, Term2). (A)
|?- (Term1 == Term2). (B)
The following query succeeds, binding R to <
, because 1 comes
before 2 in the standard order.
| ?- compare(R, 1, 2). R = <
If Order is supplied, and is not one of <
, >
, or =
, compare/3
simply fails.
@</2
,
@=</2
,
@>/2
,
@>=/2
,
QP_compare()
ref-lte