PLOGHELP FUNCTOR Chris Mellish, August 1982
Revised by Kathryn Seifert October 1986
Predicate whose arguments are unified with a term, its functor, and
arity.
?- functor(Term, Functor, Arity).
Keywords: term, functor, arity, structure
Term is a term whose functor is Functor and whose arity is Arity. When
this predicate is called, either Term should be instantiated or both
Functor and Arity should be.
'functor' can be used to construct a term with a certain functor and
arity. For example:
?- functor(X, foo, 2).
X = foo(_1, _2) ?
It can also be used to "examine" a given term:
?- functor(foo(a,b), Name, Arity).
Name = foo
Arity = 2 ?
-- RELATED DOCUMENTATION ----------------------------------------------
PLOGHELP * ARG
Predicate which determines the Nth argument of a given term
PLOGHELP * UNIV
Operator which makes a term from a list
PLOGHELP * DOLLAR
Library package for using variables to hold predicate names