Did you know ... | Search Documentation: |
Predicate indicators |
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>
.
The module is generally omitted if it is irrelevant (case of a built-in
predicate) or if it can be inferred from context.
Compliant to the ISO
standard draft on Definite Clause Grammars (see
section 4.13), SWI-Prolog
also allows for the non-terminal indicator to refer to a DCG
grammar rule. The non-terminal indicator is written as [<module>]:<name>//<arity>
.
A non-terminal indicator <name>//<arity>
is understood to be equivalent to <name>/<arity>+2
,
regardless of whether or not the referenced predicate is defined or can
be used as a grammar rule.53This,
however, makes a specific assumption about the implementation of DCG
rules, namely that DCG rules are preprocessed into standard Prolog rules
taking two additional arguments, the input list and the output list, in
accumulator style. This need not be true in all
implementations. 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.
//