11.4.3.1 Testing the type of a term
- int PL_term_type(term_t)
- Obtain the type of a term, which should be a term returned by one of the 
other interface predicates or passed as an argument. The function 
returns the type of the Prolog term. The type identifiers are listed 
below. Note that the extraction functions PL_get_*()also validate the type and thus the two sections below are equivalent.if ( PL_is_atom(t) ) { char *s; PL_get_atom_chars(t, &s); ...; } or char *s; if ( PL_get_atom_chars(t, &s) ) { ...; }VersionĀ 7 added PL_NIL,PL_BLOB,PL_LIST_PAIRandPL_DICT. Older versions classifyPL_NILandPL_BLOBasPL_ATOM,PL_LIST_PAIRasPL_TERMand do not have dicts.PL_VARIABLEA variable or attributed variable PL_ATOMA Prolog atom PL_NILThe constant []PL_BLOBA blob (see section 11.4.7.2) PL_STRINGA string (see section 5.2) PL_INTEGERA integer PL_FLOATA floating point number PL_TERMA compound term PL_LIST_PAIRA list cell ( [H|T])PL_DICTA dict (see section 5.4)) 
The functions PL_is_<type> are an alternative to PL_term_type(). 
The test PL_is_variable(term) 
is equivalent to
PL_term_type(term) 
== PL_VARIABLE, but the first is considerably faster. On the 
other hand, using a switch over PL_term_type() 
is faster and more readable then using an if-then-else using the 
functions below. All these functions return either TRUE or FALSE.
- int PL_is_variable(term_t)
- Returns non-zero if term is a variable.
- int PL_is_ground(term_t)
- Returns non-zero if term is a ground term. See also ground/1. This function is cycle-safe.
- int PL_is_atom(term_t)
- Returns non-zero if term is an atom.
- int PL_is_string(term_t)
- Returns non-zero if term is a string.
- int PL_is_integer(term_t)
- Returns non-zero if term is an integer.
- int PL_is_float(term_t)
- Returns non-zero if term is a float.
- int PL_is_callable(term_t)
- Returns non-zero if term is a callable term. See callable/1 for details.
- int PL_is_compound(term_t)
- Returns non-zero if term is a compound term.
- int PL_is_functor(term_t, functor_t)
- Returns non-zero if term is compound and its functor is functor. This test is equivalent to PL_get_functor(), followed by testing the functor, but easier to write and faster.
- int PL_is_list(term_t)
- Returns non-zero if term is a compound term using the list constructor or the list terminator. See also PL_is_pair() and PL_skip_list().
- int PL_is_pair(term_t)
- Returns non-zero if term is a compound term using the list constructor. See also PL_is_list() and PL_skip_list().
- int PL_is_atomic(term_t)
- Returns non-zero if term is atomic (not variable or compound).
- int PL_is_number(term_t)
- Returns non-zero if term is an integer or float.
- int PL_is_acyclic(term_t)
- Returns non-zero if term is acyclic (i.e. a finite tree).