Logtalk reference manual
Predicate directive: meta_predicate/1

meta_predicate/1

Description

meta_predicate(MetaPredicate)

Declares meta-predicates, i.e., predicates that have arguments that will be called as goals. An argument may also be a closure instead of a goal if the meta-predicate uses the call/N Logtalk built-in methods to construct and call the actual goal from the closure and the additional arguments.

Meta-arguments which are goals are represented by the integer 0. Meta-arguments which are closures are represented by a positive integer, N, representing the number of additional arguments that will be appended to the closure in order to construct the corresponding meta-call. Normal arguments are represented by the atom *. Meta-arguments are always called in the context of the sender, i.e. in the meta-predicate calling context, not in the meta-predicate definition context.

Template and modes

meta_predicate(+meta_predicate_mode_indicator)

Examples

:- meta_predicate(findall(*, 0, *)).

:- meta_predicate(forall(0, 0)).

:- meta_predicate(maplist(2, *, *))