Meta Directives

The meta-predicate declaration takes as an argument a predicate name and a number of meta-argument specifiers. Analogously the meta-function directive takes as an argument a function name and a number of meta-argument specifiers. We can describe the arguments via the following grammar rules:

meta_directive    --> "meta_predicate" meta_signature
| "meta_function" meta_signature.

meta_signature --> module ":" meta_signature
| name [ "(" meta_specifier
{ "," meta_specifier } ")" ].

meta_specifier --> integer
| "?"
| "::(" meta_specifier2 ")"
| "#(" meta_specifier3 ")"

meta_specifier2 --> integer
| "::(" meta_specifier2 ")".

meta_specifier3 --> integer.

Example:
:- meta_predicate count(0,?).

A positive integer n indicates a goal and a negative integer n indicates a clause. If the integer n, respectively –n-1 if n<0, is different from zero then the argument is a goal closure respectively clause closure. The question mark (?) indicates that the argument is neither a goal nor a clause. The (::)/1 wrapper indicates that the argument is also an object message.

It should be noted that Jekejeke Prolog executes meta-predicates even when meta-predicate directives are not present. The meta-predicate directives are needed for pretty printing and term expansion. Closures are not supported during term expansion. Term expansion for clauses can be switched on-off by the sys_clause_expand flag, and it is on by default.

The hash tag (#) indicates that the argument is an evaluable expression. Space, newline and indent insertion will be suppressed during pretty printing. Evaluable functions don’t need special meta-predicate declarations. Meta-predicate declarations are assumed so that the whole evaluable expression is cross-referenced.

The following meta-predicate predicates are provided:

meta_predicate M, …:
The predicate sets the corresponding functor to meta-predicate declaration M.
meta_function M, …:
The predicate sets the corresponding functor to meta-function declaration M.

The following predicate properties for meta-predicates are provided:

meta_predicate M:
The property indicates that the functor has meta-predicate declaration M. The proper ty is single valued.
sys_meta_predicate(S):
The property indicates that the predicate has been declared meta-predicate in source context S. The property is multi valued and can be missing. The property can be changed.
meta_function M:
The property indicates that the functor has meta-function declaration M. The property is single valued.
sys_meta_function(S):
The property indicates that the predicate has been declared meta-function in source context S. The property is multi valued and can be missing.

The following Prolog flags for meta-predicates are provided:

sys_clause_expand:
The legal values are on and off. The flag indicates whether the clause conversion is enabled for the knowledge base. The default value is off. The value can be changed.

Comments