predicate_property/2
predicate_property(
?Callable,
?PredProperty)
Unifies PredProperty with a predicate property of an existing predicate, and Callable with the most general term that corresponds to that predicate.
The skeletal specification of a loaded predicate.
The various properties associated with Callable. Each loaded predicate will have one or more of the properties:
built_in
(for built-in predicates)
or compiled
or interpreted
(for user defined
predicates) or fd_constraint
for FD predicates
see Defining Primitive Constraints.
dynamic
for predicates that have been
declared dynamic (see Dynamic Declarations),
multifile
for predicates that have been
declared multifile (see Multifile Declarations),
volatile
for predicates that have been
declared volatile (see Volatile Declarations),
(block
Term)
for predicates
that have block declarations (see Block Declarations),
exported
or terms
imported_from(
ModuleFrom)
for predicates
exported or imported from modules (see ref-mod),
(meta_predicate
Term)
for predicates
that have meta-predicate declarations (see ref-mod-met).
If Callable
is instantiated then
predicate_property/2
successively unifies PredProperty with
the various properties associated with Callable.
If PredProperty is bound to a valid predicate property, then
predicate_property/2
successively unifies Callable with the
skeletal specifications of all loaded predicates having
PredProperty.
If Callable is not a loaded predicate or PredProperty is not a valid predicate property, the call fails.
If both arguments are unbound, then predicate_property/2
can be
used to backtrack through all currently defined predicates and their
corresponding properties.
| ?- [user]. | :- dynamic p/1. | p(a). | end_of_file. % user compiled 0.117 sec 296 bytes yes | ?- predicate_property(p(_), Property). Property = dynamic ; Property = interpreted ;
P
imported into module m
from any module:
| ?- predicate_property(m:P, imported_from(_)).
P
imported into module m1
from module m2
:
| ?- predicate_property(m1:P, imported_from(m2)).
P
exported by module m
:
| ?- predicate_property(m:P, exported).
| ?- predicate_property(M:f, imported_from(m1)).
will return all modules M
that import f/0
from m1
.