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/1
var(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.
jTrolog.engine.SimpleGoalFixture | ||
goal | success() | exception() |
var(foo). | false | no exception |
var(Foo). | true | no exception |
foo = Foo, var(Foo). | false | no exception |
var(_). | true | no exception |
atom/1
atom(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.
jTrolog.engine.SimpleGoalFixture | ||
goal | success() | exception() |
atom(atom). | true | no exception |
atom('string'). | true | no exception |
atom(a(b)). | false | no exception |
atom(Var). | false | no exception |
atom([]). | true | no exception |
atom(6). | false | no exception |
atom(3.3). | false | no exception |
integer/1
integer(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.
jTrolog.engine.SimpleGoalFixture | ||
goal | success() | exception() |
integer(3). | true | no exception |
integer(-3). | true | no exception |
integer(3.3). | false | no exception |
integer(X). | false | no exception |
integer(atom). | false | no exception |
float/1
float(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.
jTrolog.engine.SimpleGoalFixture | ||
goal | success() | exception() |
float(3.3). | true | no exception |
float(-3.3). | true | no exception |
float(3). | false | no exception |
float(atom). | false | no exception |
float(X). | false | no exception |
atomic/1
atomic(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.
jTrolog.engine.SimpleGoalFixture | ||
goal | success() | exception() |
atomic(atom). | true | no exception |
atomic(a(b)). | false | no exception |
atomic(Var). | false | no exception |
atomic(6). | true | no exception |
atomic(3.3). | true | no exception |
compound/1
compound(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.
jTrolog.engine.SimpleGoalFixture | ||
goal | success() | exception() |
compound(33.3). | false | no exception |
compound(-33.3). | false | no exception |
compound(-a). | true | no exception |
compound(_). | false | no exception |
compound(a). | false | no exception |
compound(a(b)). | true | no exception |
compound([]). | false | no exception |
compound([a]). | true | no exception |
nonvar/1
nonvar(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.
jTrolog.engine.SimpleGoalFixture | ||
goal | success() | exception() |
nonvar(33.3). | true | no exception |
nonvar(foo). | true | no exception |
nonvar(Foo). | false | no exception |
foo = Foo, nonvar(Foo). | true | no exception |
nonvar(a(b)). | true | no exception |
number/1
number(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.
jTrolog.engine.SimpleGoalFixture | ||
goal | success() | exception() |
number(3). | true | no exception |
number(3.3). | true | no exception |
number(-3). | true | no exception |
number(a). | false | no exception |
number(X). | false | no exception |
The results of the tests for Type testing are as follows:
fit.Summary |