|Did you know ...||Search Documentation:|
|Declaring predicate properties|
This section describes directives which manipulate attributes of predicate definitions. The functors dynamic/1, multifile/1, discontiguous/1 and public/1 are operators of priority 1150 (see op/3), which implies that the list of predicates they involve can just be a comma-separated list:
:- dynamic foo/0, baz/2.
In SWI-Prolog all these directives are just predicates. This implies they can also be called by a program. Do not rely on this feature if you want to maintain portability to other Prolog implementations.
Notably with the introduction of tabling (see section
7) it is common that a set of predicates require multiple options to
be set. SWI-Prolog offers two mechanisms to cope with this. The
can be used to make a list of predicates dynamic and set additional
options. In addition and for compatibility with XSB,87Note
as is in XSB a high-priority operator and in SWI a
low-priority and therefore both the sets of predicate indicators as
multiple options require parenthesis. all the predicates
below accept a term
as((:PredicateIndicator, ... ), (+Options)),
where Options is a comma-list of one of more of the
incremental. For XSB compatibility.88In XSB,
opaqueis distinct from the default in the sense that dynamic switching between
incrementalto reduce the dependency graph. See section 7.7.
Below are some examples, where the last two are semantically identical.
:- dynamic person/2 as incremental. :- dynamic (person/2,organization/2) as (incremental, abstract(0)). :- dynamic([ person/2, organization/2 ], [ incremental(true), abstract(0) ]).
:- dynamic (p/1) as (incremental,abstract(0)).syntax. See the introduction of section 4.15. Defined Options are:
incremental. The only supported value is
0. With this option a call to the incremental dynamic predicate is recorded as the most generic term for the predicate rather than the specific variant.
local. See also thread_local/1.
non_terminalproperty on the predicate. This indicates that the predicate implements a grammar rule. See predicate_property/2. The
non_terminalproperty is set for predicates exported as Name//Arity as well as predicates that have at least one clause written using the