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

is_predicate(++PredSpec)

Succeeds if PredSpec is a defined predicate.
PredSpec
Predicate of the form Atom/Integer.

Description

Used to test whether PredSpec is defined as a user or a built-in predicate.

Modes and Determinism

Modules

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

Fail Conditions

Fails if PredSpec is not a valid predicate

Exceptions

(4) instantiation fault
PredSpec is not fully instantiated.
(5) type error
PredSpec is not in the format Atom/Integer.

Examples

Success:
[eclipse]: [user].
    a(1).
    a(1,2).
    a(1,2,3).
    user compiled 144 bytes in 0.00 seconds
   yes.
   [eclipse]: is_predicate(a/1).
   yes.
   [eclipse]: is_predicate(a/2).
   yes.
   [eclipse]: is_predicate(nl/0).
   yes.
   [eclipse]: is_predicate(a/2).
   yes.
Fail:
   is_predicate(a/0).         % Fails if a/0 is not a predicate
Error:
   is_predicate(X).          (Error 4).
   is_predicate(a/X).        (Error 4).
   is_predicate(a).          (Error 5).
   is_predicate(1).          (Error 5).



See Also

get_flag / 3, pred / 1, current_predicate / 1, current_built_in / 1