instantiation_error()if Term is unbound and Name/Arity is insufficiently instantiated.
SWI-Prolog also supports terms with arity 0, as in
section 5. Such terms
must be processed using
The predicate functor/3
and =../2 raise a
when faced with these terms. Without this precaution, the inconsistency
demonstrated below could happen silently.95Raising
a domain error was suggested by Jeff Schultz.
?- functor(a(), N, A). N = a, A = 0. ?- functor(T, a, 0). T = a.