9.4.4 Testing Prolog Terms

There is one general function for type testing of Prolog terms and a set of specialized, more efficient, functions, one for each term type:

int SP_term_type(SP_term_ref t)
Depending on the type of the term t, one of SP_TYPE_VARIABLE, SP_TYPE_INTEGER, SP_TYPE_FLOAT, SP_TYPE_ATOM, or SP_TYPE_COMPOUND is returned.
int SP_is_variable(SP_term_ref t)
Returns nonzero if the term is a Prolog variable, zero otherwise.
int SP_is_integer(SP_term_ref t)
Returns nonzero if the term is a Prolog integer, zero otherwise.
int SP_is_float(SP_term_ref t)
Returns nonzero if the term is a Prolog float, zero otherwise.
int SP_is_atom(SP_term_ref t)
Returns nonzero if the term is a Prolog atom, zero otherwise.
int SP_is_compound(SP_term_ref t)
Returns nonzero if the term is a Prolog compound term, zero otherwise.
int SP_is_list(SP_term_ref t)
Returns nonzero if the term is a Prolog list, zero otherwise. Note that only the principal functor matters: the function returns zero if the term is the empty list, and nonzero if it's a non-strict list.
int SP_is_atomic(SP_term_ref t)
Returns nonzero if the term is an atomic Prolog term, zero otherwise.
int SP_is_number(SP_term_ref t)
Returns nonzero if the term is a Prolog number, zero otherwise.