[top] [up] [next]
Term precedence
In standard Prolog all the terms are ordered, this order is:
- Variable.
- Floating-point number.
- Integer number.
- Atom.
- Compound term (a structure).
All variables precede all floating-point numbers, which precede all integer numbers,
which precede all atoms and which precede all compound terms.
- The ISO Prolog standard leaves the ordering of variables partially undefined,
so Trinc-Prolog uses the following rule for ordering variables: empty variables
precede non-empty variables and if two empty variables are compared the names of
the variables determine the order. If two non-empty variables are compared the values of
the variables are used for ordering.
- All numbers, of the same type, are ordered according to the usual arithmetic rules
(floating-point numbers and integer numbers have different types).
- All atoms are ordered ascending according to the characters of their names. The ordering
used is based on the ASCII table.
- Compound terms are ordered according to their arity (=the number of arguments). If the
arity is equal the name of the functor of the compound term is used. If the names of the
functors are equal the arguments of the compound term are used.
The term precedence operators are:
| @>/2 |
term greater than |
| @>= /2 |
term greater than or equal |
| == /2 |
tests whether both arguments are identical |
| @< /2 |
term less than |
| @=< /2 |
term less than or equal |
| \== /2 |
tests whether the arguments are different terms |
[top] [up] [next]
info@trinc-prolog.com