Next: mpg-ref-garbage_collect, Previous: mpg-ref-frozen, Up: mpg-bpr [Contents][Index]
functor/3 ISOfunctor(+Term, -Name, -Arity)
functor(-Term, +Name, +Arity)
Succeeds if the principal functor of term Term has name Name and arity Arity.
term
atom
arity
There are two ways of using this predicate:
instantiation_errorTerm and either Name or Arity are uninstantiated.
type_errorName is not atomic, or Arity is not an integer, or Name is not an atom when Arity > 0.
domain_errorArity is an integer < 0.
representation_errorTerm is uninstantiated and Arity > 255.
| ?- functor(foo(a,b), N, A). N = foo, A = 2 | ?- functor(X, foo, 2). X = foo(_A,_B)
| ?- functor(X, 2, 0). X = 2
arg/3, name/2, =../2, ref-lte-act.