|Did you know ...
|Analysing compound terms
Compound terms can be viewed as an array of terms with a name and
arity (length). This view is expressed by overloading the
type_error is raised if the argument is not compound
domain_error if the index is out of range.
In addition, the following functions are defined:
type_error is raised. Id arg is out of range, a
domain_error is raised. Please note the counting from 1
which is consistent to Prolog's arg/3
predicate, but inconsistent to C's normal view on an array. See also
class PlCompound. The following
example tests x to represent a term with first-argument an
atom or string equal to
..., if ( x == "gnat" ) ...
const char * holding the name of the functor of
the compound term. Raises a
type_error if the argument is
if the argument is not compound.