12.3.32 SP_get_functor()


#include <sicstus/sicstus.h>

SP_get_functor(SP_term_ref term,
               SP_atom *name,
               int *arity);

Assigns to *name and *arity the canonical representation and arity of the principal functor of a Prolog compound term. If the value of term is an atom, then that atom is assigned to *name and 0 is assigned to *arity. This is similar to calling functor/3 with the first argument bound to a compound term or an atom and the second and third arguments unbound.



The SP_term_ref holding the value


The location to assign to the functor name


The location to assign to the functor arity

Return Value

Zero if the conversion fails (as far as failure can be detected), and a nonzero value otherwise.

See Also

Accessing Prolog Terms.

Send feedback on this subject.