- Documentation
- Reference manual
- Modules
- Why Use Modules?
- Defining a Module
- Importing Predicates into a Module
- Controlled autoloading for modules
- Defining a meta-predicate
- Overruling Module Boundaries
- Interacting with modules from the top level
- Composing modules from other modules
- Operators and modules
- Dynamic importing using import modules
- Reserved Modules and using the‘user’module
- An alternative import/export interface
- Dynamic Modules
- Transparent predicates: definition and context module
- Module properties
- Compatibility of the Module System
- Modules
- Packages
- Reference manual
6.8 Composing modules from other modules
The predicates in this section are intended to create new modules
from the content of other modules. Below is an example to define a
composite module. The example exports all public predicates of module_1
, module_2
and module_3
, pred/1
from module_4
, all predicates from module_5
except
do_not_use/1
and all predicates from module_6
while renaming
pred/1 into mypred/1.
:- module(my_composite, []). :- reexport([ module_1, module_2, module_3 ]). :- reexport(module_4, [ pred/1 ]). :- reexport(module_5, except([do_not_use/1])). :- reexport(module_6, except([pred/1 as mypred])).
- reexport(+Files)
- Load and import predicates as use_module/1 and re-export all imported predicates. The reexport declarations must immediately follow the module declaration.
- reexport(+File, +Import)
- Import from File as use_module/2 and re-export the imported predicates. The reexport declarations must immediately follow the module declaration.