(meta_predicate)/1
[declaration]:- meta_predicate
+MetaSpec
Provides for module name expansion of arguments in calls to the
predicate given by MetaSpec. All meta_predicate/1
declarations
should be at the beginning of a module.
Goal template or list of goal templates, of the form
functor(
Arg1,
Arg2,...)
.
Each Argn is one of:
type_error
domain_error
context_error
Consider a sort routine,
mysort/3
, to which the name of the comparison predicate is passed as
an argument:
mysort(CompareProc, InputList, OutputList)
If CompareProc is module sensitive, an appropriate meta_predicate
declaration for mysort/3
is:
:- meta_predicate mysort(:, +, -).
This means that whenever a goal mysort(
A,
B,
C)
appears in a clause, it will be transformed at load time
into mysort(
M:
A,
B,
C)
, where M
is the source module. The transformation will happen unless:
Meta-Predicate Declarations, ref-mod-mne.