|
|
D Comparison Operators
D.1 Arithmetic Comparison Operators
The arithmetic comparison operators are :<=<>>==:=/=
X<Y
True if X is less than Y.
X=<Y
True if X is less than or equal to Y.
X>Y
True if X is greater than Y.
X>=
True if X is greater than or equal to Y.
X=:=Y
True if X is equal to Y.
X=/=Y
True if the values of X and Y are not equal
Unlike unification theses operators cannot be used to give values to a variable. The can only be evaluated when every term on each side have been instantiated.
D.2 Term Comparison
comparison
There is an order on the Prolog terms. The operators of comparison are :@<@=<@>@>=
X@<Y
The term X is less than Y
Y@=<Y
The term X is less than or equal to Y
X@>Y
The term X is greater than Y
X@>=Y
The term X is greater or equal to Y
The term order from the lowest to the highest is :
1. Variables.
2. Floating point numbers.
3. Integers.
4. atoms in the alphabetical order.
|
|