Meta-Logical

var(X)
var/1 (I) Tests whether X is currently instantiated to a variable.

nonvar(X)
nonvar/1 (I) Tests whether X is currently instantiated to a non-variable term.

atom(X)
atom/1 (B) Checks that X is currently instantiated to an atom (i.e. a non-variable term of arity 0, other than a number).

integer(X)
integer/1 (I) Checks that X is currently instantiated to an integer.

real(X)
real/1 (I) Checks that X is currently instantiated to a floating point number.

float(X)
float/1 (I) Same as real/1, checks that X is currently instantiated to a floating point number.

number(X)
number/1 (B) Checks that X is currently instantiated to a number, i.e. that it is either an integer or a real.

atomic(X)
atomic/1 (B) Checks that X is currently instantiated to an atom or number.

structure(X)
structure/1 (B) Checks that X is currently instantiated to a compound term, i.e. to a nonvariable term that is not atomic.

is_buffer(X)
is_buffer/1 (B) Succeeds if X is instantiated to a buffer.

functor(T, F, N)
functor/3 (L) The principal functor of term T has name F and arity N, where F is either an atom or, provided N is 0, a number. Initially, either T must be instantiated to a non-variable, or F and N must be instantiated to, respectively, either an atom and a non-negative integer or an integer and 0. If these conditions are not satisfied, an error message is given. In the case where T is initially instantiated to a variable, the result of the call is to instantiate T to the most general term having the principal functor indicated.

arg(I, T, X)
arg/3 (I) Initially, I must be instantiated to a positive integer and T to a compound term. The result of the call is to unify X with the Ith argument of term T. The arguments are numbered from 1 upwards.) If the initial conditions are not satisfied or I is out of range, the call merely fails.

X$\bf =..$Y
=../2 (L) Y is a list whose head is the atom corresponding to the principal functor of X and whose tail is the argument list of that functor in X. E.g.
product(0,N,N-1) =.. [product,0,N,N-1]

N-1 =.. [-,N,1]

product =.. [product]
If X is instantiated to a variable, then Y must be instantiated either to a list of determinate length whose head is an atom, or to a list of length 1 whose head is a number.

name(X, L)
name/2 (B) If X is an atom or a number then L is a list of the ASCII codes of the characters comprising the name of X. E.g.
name(product,[112,114,111,100,117,99,116])
i.e. name(product,"product").

If X is instantiated to a variable, L must be instantiated to a list of ASCII character codes. E.g.

| ?- name(X,[104,101,108,108,111])).
X = hello

| ?- name(X,"hello").
X = hello

call(X)
call/1 (P) If X is a nonvariable term in the program text, then it is executed exactly as if X appeared in the program text instead of call(X), e.g.
…, p(a), call( (q(X), r(Y)) ), s(X), …
is equivalent to
…, p(a), q(X), r(Y), s(X), …
However, if X is a variable in the program text, then if at runtime X is instantiated to a term which would be acceptable as the body of a clause, the goal call(X) is executed as if that term appeared textually in place of the call(X), except that any cut (`!') occurring in X will remove only those choice points in X. If X is not instantiated as described above, an error message is printed and call fails.

X
(where X is a variable) Exactly the same as call(X). However, we prefer the explicit usage of call/1 as good programming practice, and the use of a top level variable subgoal elicits a warning from the compiler.

conlength(C, L)
conlength/2 (B) Succeeds if the length of the print name of the constant C (which can be an atom, buffer or integer), in bytes, is L. If C is a buffer (see Section [*]), it is the length of the buffer; if C is an integer, it is the length of the decimal representation of that integer, i.e., the number of bytes that a $writename will use.