True if Term is bound to a string. Note that string here
refers to the built-in atomic type string as described in
section 4.24, Text in double
quotes such as "hello"
creates a list of character
codes. We illustrate the issues in the example queries below.
?- write("hello").
[104, 101, 108, 108, 111]
true.
?- string("hello").
false.
?- is_list("hello").
true.
True if Term is bound to an atom or a compound term. This was
intended as a type-test for arguments to call/1
and call/2..
Note that callable only tests the surface term. Terms such as
(22,true) are considered callable, but cause call/1
to raise a type error. Module-qualification of meta-argument (see meta_predicate/1)
using
:/2 causes callable to succeed on any meta-argument.40We
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)