[ Predicate Database and Compiler | Reference Manual | Alphabetic Index ]

current_predicate(?PredSpec)

Succeeds if PredSpec is a visible predicate defined by the user, or a visible library predicate.
PredSpec
Expression of the form Atom/Integer or variable.

Description

Used to check that PredSpec is a user or library predicate visible from the context module, or else to return on backtracking all the current visible predicates.

Modes and Determinism

Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

Fail Conditions

Fails if PredSpec is not a visible (user or library) predicate

Exceptions

(5) type error
PredSpec is instantiated, but not to the form Atom/Integer.

Examples

Success:
     [eclipse]: current_predicate(X/Y).
     X = intersection
     Y = 3     More? (;)
     yes.
     [eclipse]: current_predicate(X).
     X = (^) / 2     More? (;)
     X = intersection / 3     More? (;)
     X = subtract / 3     More? (;)
     X = append / 3     More? (;)
     yes.

     [eclipse]: [user].
      p.
      user compiled 28 bytes in 0.00 seconds
     yes.
     [eclipse]: current_predicate(p/0).
     yes.
Fail:
     current_predicate(assert/1).
Error:
     current_predicate(a/a).         (Error 5).



See Also

current_module_predicate / 2, current_built_in / 1, is_predicate / 1, get_flag / 3