Ordering is the atom '<' iff Term1 comes before Term2 in the standard ordering.
Ordering is the atom '>' iff Term1 comes after Term2 in the standard ordering.
Ordering is the atom '=' iff Term1 is identical to Term2.
The standard ordering of prolog terms is defined in the following increasing order:
* variables: Comparing free variables yields an undefined result.
* reals: from MINREAL to MAXREAL
* integers: from MININT to MAXINT
* strings: lexicographical (ASCII) order
* atoms: lexicographical (ASCII) order
* compound terms: first by arity, then by functor name, then by the arguments in left to right order.
Success: compare(X, A, a), X = '<'. compare(X, a, A), X = '>'. compare('<', a(1,2), b(1,2)). compare(X, 1, 1), X = '='. compare(X, f(1), f(1)), X = '='. compare('<', 3.0, 2). compare('>', [a,b], [a|b]). compare('>', [a,b], [a|X]). Fail: compare('<', atomb, atoma). compare('=', 0, 1). compare('>',1.0,1).