Availability:built-in
current_functor(?Name,
?Arity)True when Name/Arity is a known functor. This
means that at some point in time a term with name Name and Arity
arguments was created. Functor objects are currently not subject to
garbage collection. Due to timing, t/2 below with instantiated
Name and Arity can theoretically fail, i.e., a
functor may be visible in instantiated mode while it is not yet visible
in unbound mode. Considering that the only practical value of current_functor/2
we are aware of is to analyse resource usage we accept this impure
behaviour.
t(Name, Arity) :-
( current_functor(Name, Arity)
-> current_functor(N, A), N == Name, A == Arity
; true
).