Download B-Prolog User`s Manual

Transcript
will be replaced by the directives and clauses in File, which must be a valid Prolog
text file. The extension name can be omitted if it is pl.
6.3
Initialization
The directive
:-initialization(Goal).
is equivalent to:
:-Goal.
unless Goal is a directive. It specifies that as soon as the program is loaded or
consulted, the goal Goal is to be executed.
6.4
Dynamic declaration
A predicate is either static or dynamic. Static predicates cannot be updated during
execution. Dynamic predicates are stored in consulted form, and can be updated
during execution. Predicates are assumed to be static, unless they are explicitly
declared to be dynamic. In order to declare predicates to be dynamic, use the
following declaration:
:-dynamic Atom/Arity,...,Atom/Arity.
6.5
multifile/1
In order to inform the system that the definition of a predicate F/N can occur in
multiple files, use the following declaration:
:-multifile F/N.
Such a declaration must occur before any clause that defines the predicate F/N in
every file. Note that, if a predicate is declared multifile, it will be treated as
dynamic, and its definition is never initialized when a file is loaded.
6.6
Tabled predicate declaration
A tabled predicate is a predicate for which answers will be memorized in a table,
and for which variant calls of the predicate will be resolved by using the answers.
The declaration,
:-table P1/N1, ..., Pk/Nk.
declares that the predicates Pi/Ni (i=1,...,k) are tabled predicates.
33