==/2, \==/2, @</2, @=</2, @>/2, @>=/2

check the relation of two terms according to the given operation.

+Term1 == +Term2
+Term1 \== +Term2
+Term1 @< +Term2
+Term1 @=< +Term2
+Term1 @> +Term2
+Term1 @>= +Term2

These predicates check the relation of Term1 and Term2.

Different types of the terms have the following relation:

             variable < floating point number
floating point number < integer
              integer < atom
                 atom < compound term (structure)


Same types of terms have the following order:

termtype order
variable have no special order
floating point number arithmetical order
integer arithmetical order
atom character-order
compound term first they are ordered by their arity. If they have same arity, they are ordered by the name of their functor. If they have same arity and functor, they are ordered by the arguments, starting at the first one.

Operator op Meaning
== Terms are identical
\== Terms are not identical
@> Left term greater than right term
@>= Left term greater than or equal to right term
@< Left term less than right term
@=< Left term less than or equal to right term


'==', '\==', '@<', '@=<', '@>', '@>=' are predefined infix-operators. The predefined priority is 700 and they are non-associative (see current_op/3).

Arguments

Term1             term
Term2             term

Examples

------- == -------

X=5, f(X) == f(5). Succeeds with substitution X <- 5.

X= f(A,B), X= f(g(C,D), g(C,D)), A==B). Succeeds with substitution X <- f(g(C,D), g(C,D), A <- g(C,D), B <- g(C,D).

f(X) == f(Y). Fails.

1 == 1.0 Fails.

------- \== -------

f(X) \== f(Y). Succeeds.

f(X,Y) \== f(X,a). Succeeds.

1.0e+2 \== 100. Fails.

X=a, f(X,Y) \== f(a,Y). Fails.

------- @< -------

f(a) @< f(b). Succeeds.

f(1,X) @< f(2,X). Succeeds.

'@<'(f(a,b), g(a,b)). Succeeds.

f(a,b) @< g(a). Fails.

------- @=< -------

f(a) @=< f(b). Succeeds.

12 @=< 12. Succeeds.

'@=<'(X, Y). Succeeds.

text @=< texas Fails.

------- > --------

text @> texas. Succeeds.

f(a,b) @> f(a). Succeeds.

f(a,b) @> g(a,b). Fails.

'@>'(f(Y,X), f(X,Y). Fails.

------- >= -------

text @>= text. Succeeds.

'@>='(1, 1.0). Succeeds.

f(a) @>= f(b). Fails.

Standard

These predicates are part of the ISO-Prolog Standard.


Darueber read on...