Type tests are semi-deterministic predicates that succeed if the
argument satisfies the requested type. Type-test predicates have no
error condition and do not instantiate their argument. See also library
library(error)
.
"hello"
.65In
traditional Prolog systems, double quoted text is often mapped to a list
of character codes. See also the Prolog flag
double_quotes.atomic(Term) :- nonvar(Term), \+ compound(Term).
SWI-Prolog defines the following atomic datatypes: atom (atom/1),
string (string/1),
integer (integer/1),
floating point number (float/1),
rational (rational/1)
and blob (blob/2).
In addition, the symbol
[]
(empty list) is atomic, but not an atom. See
section 5.1.
:
/2
causes callable to succeed on any
meta-argument.66We think that callable/1
should be deprecated and there should be two new predicates, one
performing a test for callable that is minimally module aware and
possibly consistent with type-checking in call/1
and a second predicate that tests for atom or compound.
Consider the program and query below:
:- meta_predicate p(0). p(G) :- callable(G), call(G). ?- p(22). ERROR: Type error: `callable' expected, found `22' ERROR: In: ERROR: [6] p(user:22)