The normal method of defining relations in Common Prolog is to use the
(defrel <relation name >
> is of the form:
(<clause head >
and declarations may include:
(mode arg-mode*) and any of the normal Lisp optimization declarations. Mode declarations determine how much clause indexing will be done on the predicate and can also streamline generated code for a predicate that will only be used in certain ways. A mode declaration consists of the word "MODE" followed by a mode spec for each argument position of the predicate. The possible argument mode specs are:
Generate completely general code for this arg and don't index on it.
Generate completely general code and index.
Generate code assuming this argument will be bound on entry and index.
Generate code assuming this argument will be unbound on entry and don't index.
The default mode specs are
?* for the first argument and
? for all the rest.
KnowledgeWorks and Prolog User Guide (Unix version) - 24 Mar 2017