Section "database"
Besides input/output, the dynamic database of a Prolog system
provides further means to have side effects by Prolog code.
Currently we do compile Prolog clauses that are dynamically
as-serted, which incurs a little cost, but provides faster
retrieval.
The following database predicates are provided:
- dynamic I: [ISO 7.4.2.1]
- The predicate succeeds. As a side effect, the predicate I is
touched.
- asserta(C): [ISO 8.9.1]
- The predicate succeeds. As a side effect, the clause C is
inserted at the top.
- assertz(C): [ISO 8.9.2]
- The predicate succeeds. As a side effect, the clause C is
inserted at the bottom.
- clause(H, B): [ISO 8.8.1]
- The predicate succeeds with the clauses that unify H :- B.
- retract(C): [ISO 8.9.3]
- The predicate succeeds with the clauses that unify C. As a
side effect, the clause is removed.
- retractall(H): [TC2 8.9.5]
- The predicate succeeds. As a side effect, the clauses that
unify the head H are removed.
- abolish(I): [ISO 8.9.4]
- The predicate succeeds. As a side effect, the predicate I is
destroyed.
- current_predicate(I): [ISO 8.8.2]
- The predicate succeeds in I with current predicate indicators.
- predicate_property(I, P):
- The predicate succeeds in P with the properties of the
predicate indicator I. The following properties are supported:
- static: The predicate is static.
- dynamic: The predicate is dynamic.
- sys_multifile(S): The predicate is marked multifile in the
source path S.
- sys_usage(S): The predicate is defined in the source path S.
- sys_discontiguous(S): The predicate is marked discontinuous in
the source path S.
Kommentare