4.7.1 Standard Order of Terms

Comparison and unification of arbitrary terms. Terms are ordered in the so-called ``standard order''. This order is defined as follows:

  1. Variables < Numbers < Atoms < Strings < Compound Terms39Strings might be considered atoms in future versions. See also section 4.24
  2. Variables are sorted by address. Attaching attributes (see section 6.1) does not affect the ordering.
  3. Atoms are compared alphabetically.
  4. Strings are compared alphabetically.
  5. Numbers are compared by value. Mixed integer/float are compared as floats. If the comparison is equal, the float is considered the smaller value. If the Prolog flag iso is defined, all floating point numbers precede all integers.
  6. Compound terms are first checked on their arity, then on their functor name (alphabetically) and finally recursively on their arguments, leftmost argument first.
[ISO]@Term1 == @Term2
True if Term1 is equivalent to Term2. A variable is only identical to a sharing variable.
[ISO]@Term1 \== @Term2
Equivalent to \+Term1 == Term2.
[ISO]@Term1 @< @Term2
True if Term1 is before Term2 in the standard order of terms.
[ISO]@Term1 @=< @Term2
True if both terms are equal (==/2) or Term1 is before Term2 in the standard order of terms.
[ISO]@Term1 @> @Term2
True if Term1 is after Term2 in the standard order of terms.
[ISO]@Term1 @>= @Term2
True if both terms are equal (==/2) or Term1 is after Term2 in the standard order of terms.
[ISO]compare(?Order, @Term1, @Term2)
Determine or test the Order between two terms in the standard order of terms. Order is one of <, > or =, with the obvious meaning.
Tags are associated to your profile if you are logged in