current_predicate/2

Synopsis

current_predicate(-Name, +Term)

current_predicate(*Name, *Term)

Unifies Name with the name of a user-defined predicate, and Term with the most general term corresponding to that predicate.

Arguments


Name atom

Term callable [MOD]

Description

If you have loaded the predicates foo/1 and foo/3 into Prolog, current_predicate/2 would return the following:

      | ?- current_predicate(foo, T).
     
     T = foo(_116) ;
     
     T = foo(_116,_117,_118) ;
     
     no
     

Backtracking

Tip

To find out whether a predicate is built-in, use predicate_property/2.

     % Is there a callable predicate named gc?
     
     | ?- current_predicate(gc, Term).
     
     no
     | ?- predicate_property(gc, Prop)
     
     Prop = built_in
     

See Also

predicate_property/2