:- meta_predicate +MetaSpec
Provides for module name expansion of arguments in calls to the
predicate given by MetaSpec. All
must be at the beginning of a module.
Each Argn is one of:
declarations must be at the beginning of a module, immediately after
the module declaration, because the
meta_predicate declarations need to be
known at the time other modules are loaded if those modules use the
The reason for allowing a non-negative integer as an alternative to
: is that this may be used in the future to supply additional
information to the cross-referencer (
library(xref)) and to the Prolog
compiler. An integer n is intended to mean that that that argument is
a term, which will be supplied n additional arguments.
Represents DEC-10 Prolog-style "mode" declaration. Provides for module name expansion of arguments in MetaSpec.
meta_predicate declaration is added,
removed or changed, the file containing it, as well as all the modules
that import the predicate given by MetaSpec, must be reloaded.
Consider a sort routine,
mysort/3, to which the name of the comparison predicate is passed as
mysort(+CompareProc, +InputList, -OutputList)
If CompareProc is module sensitive, an appropriate
:- meta_predicate mysort(:, +, -).
This means that whenever a goal
) appears in a
clause, it will be transformed at load time into
), where M is the source module. The transformation will happen
Many examples in library, e.g.