These predicates test the type associated with a term.
A goal executing any of these predicates simply succeeds or fails; there is no side effect, unification, or error.
var/1var(X) is true iff X is a member of the variable set as defined by the specification.
Templates and modes for the predicate are as follows:
var(@term)
Let's start with some simple tests verifying success of failure of single goals.
| alice.tuprolog.SimpleGoalFixture | |
| goal | success() |
| var(foo). | false |
| var(Foo). | true |
| foo = Foo, var(Foo). | false |
| var(_). | true |
atom/1atom(X) is true iff X is a member of the atom set as defined by the specification.
Templates and modes for the predicate are as follows:
atom(@term)
Let's start with some simple tests verifying success of failure of single goals.
| alice.tuprolog.SimpleGoalFixture | |
| goal | success() |
| atom(atom). | true |
| atom('string'). | true |
| atom(a(b)). | false |
| atom(Var). | false |
| atom([]). | true |
| atom(6). | false |
| atom(3.3). | false |
integer/1integer(X) is true iff X is a member of the integer set as defined by the specification.
Templates and modes for the predicate are as follows:
integer(@term)
Let's start with some simple tests verifying success of failure of single goals.
| alice.tuprolog.SimpleGoalFixture | |
| goal | success() |
| integer(3). | true |
| integer(-3). | true |
| integer(3.3). | false |
| integer(X). | false |
| integer(atom). | false |
float/1float(X) is true iff X is a member of the float set as defined by the specification.
Templates and modes for the predicate are as follows:
float(@term)
Let's start with some simple tests verifying success of failure of single goals.
| alice.tuprolog.SimpleGoalFixture | |
| goal | success() |
| float(3.3). | true |
| float(-3.3). | true |
| float(3). | false |
| float(atom). | false |
| float(X). | false |
atomic/1atomic(X) is true if X is an atom, integer or float, and is false if X is a variable or a compound term, w.r.t every set as defined by the specification.
Templates and modes for the predicate are as follows:
atomic(@term)
Let's start with some simple tests verifying success of failure of single goals.
| alice.tuprolog.SimpleGoalFixture | |
| goal | success() |
| atomic(atom). | true |
| atomic(a(b)). | false |
| atomic(Var). | false |
| atomic(6). | true |
| atomic(3.3). | true |
compound/1compound(X) is true iff X is a member of the compound term set as defined by the specification.
Templates and modes for the predicate are as follows:
compound(@term)
Let's start with some simple tests verifying success of failure of single goals.
| alice.tuprolog.SimpleGoalFixture | |
| goal | success() |
| compound(33.3). | false |
| compound(-33.3). | false |
| compound(-a). | true |
| compound(_). | false |
| compound(a). | false |
| compound(a(b)). | true |
| compound([]). | false |
| compound([a]). | true |
nonvar/1nonvar(X) is true iff X is not a member of the variable set as defined by the specification.
Templates and modes for the predicate are as follows:
nonvar(@term)
Let's start with some simple tests verifying success of failure of single goals.
| alice.tuprolog.SimpleGoalFixture | |
| goal | success() |
| nonvar(33.3). | true |
| nonvar(foo). | true |
| nonvar(Foo). | false |
| foo = Foo, nonvar(Foo). | true |
| nonvar(a(b)). | true |
number/1number(X) is true if X is an integer or float, and is false if X is a variable, an atom or a compound term, w.r.t every set as defined by the specification.
Templates and modes for the predicate are as follows:
number(@term)
Let's start with some simple tests verifying success of failure of single goals.
| alice.tuprolog.SimpleGoalFixture | |
| goal | success() |
| number(3). | true |
| number(3.3). | true |
| number(-3). | true |
| number(a). | false |
| number(X). | false |
Run the tests!
The results of the tests for Type testing are as follows:
| fit.Summary |