Availability:built-in
current_predicate(?Name,
:Head)Classical pre-ISO implementation of current_predicate/1,
where the predicate is represented by the head term. The advantage is
that this can be used for checking the existence of a predicate before
calling it without the need for functor/3:
call_if_exists(G) :-
current_predicate(_, G),
call(G).
Because of this intended usage, current_predicate/2
also succeeds if the predicate can be autoloaded. Unfortunately,
checking the autoloader makes this predicate relatively slow, in
particular because a failed lookup of the autoloader will cause the
autoloader to verify that its index is up-to-date.