next up previous contents
Next: arg/3 Up: Powerful Features ---Splitting Previous: clause/2

functor/3

 
?- functor(fact(male(fred),23),F,N).

F=fact

N = 2

The predicate functor/3 can be used to find the principal functor of a compound term together with its arity. It can also be used to generate structures:
 
?- functor(X,example,2).

X = example(A,B)

except that the variables will be shown differently.



Paul Brna
Mon May 24 20:14:48 BST 1999