Term comparison

These predicates test the ordering of two terms as defined by the specification.

A goal executing any of these built-in predicates simply succeeds or fails; there is no side effect, unification, or error.

1. @=</2 (term less than or equal), ==/2 (term identical), \==/2 (term not identical), @</2 (term less than), @>/2 (term greater than), @>=/2 (term greater than or equal)

These predicates also test the identity and term-precedence of their arguments. As an example, '@=<'(X, Y) is true iff X preceds Y as defined by the specification, or X and Y are identical terms.

Templates and modes for the predicate are as follows:

'@=<'(@term, @term)
'=='(@term, @term)
'\\=='(@term, @term)
'@<'(@term, @term)
'@>'(@term, @term)
'@>='(@term, @term)

1.1 Example tests

Let's start with some simple tests verifying success of failure of single goals.

alice.tuprolog.SimpleGoalFixture
goalsuccess()
'@=<'(1.0, 1). true
'@<'(1.0, 1). true
'\=='(1, 1). false
'@=<'(aardvark, zebra). true
'@=<'(short, short). true
'@=<'(short, shorter). true
'@>='(short, shorter). false
'@<'(foo(a, b), north(a)). false
'@>'(foo(b), foo(a)). true
'@<'(foo(a, X), foo(b, Y)). true
'@<'(foo(X, a), foo(Y, b)). true
'@=<'(X, X). true
'=='(X, X). true
'@=<'(X, Y). true
'=='(X, Y). false
'\=='(_, _). true
'=='(_, _). false
'@=<'(_, _). true
'@=<'(foo(X, a), foo(Y, b)). true

Run the tests!


The results of the tests for Term comparison are as follows:

fit.Summary