Section "include"

It is also possible to include Prolog clauses from a text file, resulting in predicates which pro-vide further optimizations such as body indexing. To do so we provide ISO core standard pred-icates such as include/1 and ensure_loaded/1. Diverting from the ISO core standard, a Prolog text might also contain unattended queries indicated by the (?-)/1 operator.

Prolog texts are subject to some common checks. Clauses or directives are examined by the singleton check, which gives a warning when the input text had a named variable appearing only once. A further warning respective an error aborting the clause or directive is given by the style checks concerning the discontiguous and multifile constraints.

Unlike other Prolog systems, we only provide shallow term expansion. Shallow term expansion can be defined via the multi-file predicate term_expansion/2, but there is no automatic call of goal_expansion/2 for any subgoals in the directive or clause provided as a term. Tooling can invoke expand_term/2 to apply shallow term expansion.

The following include predicates are provided:
multifile I: [ISO 7.4.2.2]
The predicate sets the predicate I to multifile.
discontiguous I: [ISO 7.4.2.3]
The predicate sets the predicate I to discontiguous.
include(P): [ISO 7.4.2.7]
The predicate succeeds. As a side effect, the path P is included.
ensure_loaded(P): [ISO 7.4.2.8]
The predicate succeeds. As a side effect, the path P is ensure loaded.
[P1, .., Pn]:
The predicate succeeds. As a side effect, the paths P1, .., Pn are ensure loaded.
make:
The predicate ensures that all used sources are loaded.
?- Q:
The directive succeeds whenever Q succeeds. Additional it writes the answer substitu-tions to the standard output.
P, R --> Q:
The fact is transformed into the clause for the non-terminal P, the push back R and the DCG body Q.
P --> Q:
The fact is transformed into the clause for the non-terminal P and the DCG body Q.
term_expansion(C, D):
This predicate can be used to define custom term expansion rules.
expand_term(C, D):
The predicate succeeds in D with the expansion of the term C.
current_source(P):
The predicate succeeds in S with the current source paths.
source_property(S, P):
The predicate succeeds in P with the properties of the source path S. The following properties are supported:

sys_link(T): The path loaded the source path T.

Kommentare