Next: , Previous: , Up: ref-mod   [Contents][Index]


4.11.14 Importing Dynamic Predicates

Imported dynamic predicates may be asserted and retracted. For example, suppose the following file is loaded via use_module/1:

:- module(m1, [f/1]).
:- dynamic f/1.
f(0).

Then f/1 can be manipulated as if it were defined in the current module. For example,

| ?- clause(f(X), true).

X = 0

The built-in predicate listing/[0,1] distinguishes predicates that are imported into the current source module by prefixing each clause with the module name. Thus,

| ?- listing(f).

m1:f(0).

However, listing/[0,1] does not prefix clauses with their module if they are defined in the source module itself. Note that

| ?- listing.

can be used to see all the dynamic predicates defined in or imported into the current type-in module. And

| ?- listing(m1:_).

can be used to see all such predicates that are defined in or imported into module m1. See mpg-ref-listing.


Send feedback on this subject.