SWI-Prolog 7.1.16 Reference Manual: Section 4.6

## 4.6 Verify Type of a Term

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)`.

[ISO]var(@Term)
  True if Term currently is a free variable.
[ISO]nonvar(@Term)
  True if Term currently is not a free variable.
[ISO]integer(@Term)
  True if Term is bound to an integer.
[ISO]float(@Term)
  True if Term is bound to a floating point number.
rational(@Term)
  True if Term is bound to a rational number. Rational numbers include integers.
rational(@Term, -Numerator, -Denominator)
  True if Term is a rational number with given Numerator and Denominator. The Numerator and Denominator are in canonical form, which means Denominator is a positive integer and there are no common divisors between Numerator and Denominator.
[ISO]number(@Term)
  True if Term is bound to an integer or floating point number.39As rational numbers are not atomic in the current implementation and we do not want to break the rule that number/1 implies atomic/1, number/1 fails on rational numbers. This will change if rational numbers become atomic.
[ISO]atom(@Term)
  True if Term is bound to an atom.
blob(@Term, ?Type)
  True if Term is a blob of type Type. See section 9.4.7.
string(@Term)
  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.

[ISO]atomic(@Term)
  True if Term is bound to an atom, string, integer or floating point number. Note that string refers to the built-in type. See string/1. Strings in the classical Prolog sense are lists and therefore compound.
[ISO]compound(@Term)
  True if Term is bound to a compound term. See also functor/3 and =../2.
[ISO]callable(@Term)
  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)

[ISO]ground(@Term)
  True if Term holds no free variables.
cyclic_term(@Term)
  True if Term contains cycles, i.e. is an infinite term. See also acyclic_term/1 and section 2.16.41The predicates cyclic_term/1 and acyclic_term/1 are compatible with SICStus Prolog. Some Prolog systems supporting cyclic terms use is_cyclic/1 .
[ISO]acyclic_term(@Term)
  True if Term does not contain cycles, i.e. can be processed recursively in finite time. See also cyclic_term/1 and section 2.16.