### 7.1 Type testing

- `var/1`, `nonvar/1`, `atom/1`, `integer/1`, `float/1`, `number/1`, `atomic/1`,
  `compound/1`, `callable/1`, `list/1`, `partial_list/1`, `list_or_partial_list/1`

#### 7.1.1 `var/1`, `nonvar/1`, `atom/1`, `integer/1`, `float/1`, `number/1`, `atomic/1`,
`compound/1`, `callable/1`, `list/1`, `partial_list/1`, `list_or_partial_list/1`

Templates

  `var(?term)
  nonvar(?term)
  atom(?term)
  integer(?term)
  float(?term)
  number(?term)
  atomic(?term)
  compound(?term)
  callable(?term)
  list(?term)
  partial_list(?term)
  list_or_partial_list(?term)`

Description

`var(Term)` succeeds if `Term` is currently uninstantiated (which therefore has not been bound to anything, except possibly another uninstantiated variable).

`nonvar(Term)` succeeds if `Term` is currently instantiated (opposite of `var/1`).

`atom(Term)` succeeds if `Term` is currently instantiated to an atom.

`integer(Term)` succeeds if `Term` is currently instantiated to an integer.

`float(Term)` succeeds if `Term` is currently instantiated to a floating point number.

`number(Term)` succeeds if `Term` is currently instantiated to an integer or a floating point number.

`atomic(Term)` succeeds if `Term` is currently instantiated to an atom, an integer or a floating point number.

`compound(Term)` succeeds if `Term` is currently instantiated to a compound term, i.e. a term of arity > 0 (a list or a structure).

`callable(Term)` succeeds if `Term` is currently instantiated to a callable term, i.e. an atom or a compound term.

`list(Term)` succeeds if `Term` is currently instantiated to a list, i.e. the atom `[]` (empty list) or a term with principal functor `’.’/2` and with second argument (the tail) a list.

`partial_list(Term)` succeeds if `Term` is currently instantiated to a partial list, i.e. a variable or a term whose the main functor is `’.’/2` and the second argument (the tail) is a partial list.

`list_or_partial_list(Term)` succeeds if `Term` is currently instantiated to a list or a partial list.

Errors

None.

Portability

`var/1`, `nonvar/1`, `atom/1`, `integer/1`, `float/1`, `number/1`, `atomic/1`, `compound/1` and `callable/1` are ISO predicates.

`list/1`, `partial_list/1` and `list_or_partial_list/1` are GNU Prolog predicates.

Copyright (C) 1999-2009 Daniel Diaz Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. More about the copyright