We have tried to keep the predicate descriptions clear and concise.
First, the predicate name is printed in bold face, followed by the
arguments in italics. Arguments are preceded by a mode indicator. There
is no complete agreement on mode indicators in the Prolog community. We
use the following definitions:36These
definitions are taken from PlDoc. The current manual has only one mode
declaration per predicate and therefore predicates with mode (+,-) and
(-,+) are described as (?,?). The
@-mode is often replaced
|+||Argument must be fully instantiated to a term that satisfies the required argument type. Think of the argument as input.|
|-||Argument must be unbound. Think of the argument as output.|
|?||Argument must be bound to a partial term of
the indicated type. Note that a variable is a partial term for any type.
Think of the argument as either input or output or
both input and output. For example, in
|:||Argument is a meta-argument. Implies |
|@||Argument is not further instantiated. Typically used for type tests.|
|!||Argument contains a mutable structure that may be modified using setarg/3 or nb_setarg/3.|
Referring to a predicate in running text is done using a predicate indicator. The canonical and most generic form of a predicate indicator is a term <module>:<name>/<arity>. If the module is irrelevant (built-in predicate) or can be inferred from the context it is often omitted. Compliant to the ISO standard draft on DCG (see section 4.12), SWI-Prolog also allows for [<module>]:<name>//<arity> to refer to a grammar rule. For all non-negative arity, <name>//<arity> is the same as <name>/<arity>+2, regardless of whether or not the referenced predicate is defined or can be used as a grammar rule. The //-notation can be used in all places that traditionally allow for a predicate indicator, e.g., the module declaration, spy/1, and dynamic/1.