Unifies Name with the name of a user-defined predicate, and Term with the most general term corresponding to that predicate.
If you have loaded the predicates
foo/3 into Prolog,
current_predicate/2 would return the following:
| ?- current_predicate(foo, T). T = foo(_116) ; T = foo(_116,_117,_118) ; no
| ?- current_predicate(Name, Module:Term).
current_predicate/2only succeeds for those predicates that are defined in the module. It fails for those predicates that are imported into a module.
| ?- current_predicate(_, m:P).
will backtrack through all predicates
P that are defined in module
To backtrack through all predicates imported by a module use
predicate_property/2 (see ref-lps-ove).
To find out whether a predicate is built-in, use
% Is there a callable predicate named
gc? | ?- current_predicate(gc, Term). no | ?- predicate_property(gc, Prop) Prop = built_in