Throughout this documentation the following notational conventions are used:
The following prefixes to argument names indicate how to call the documented predicate:
+: at call time the respective argument must be bound, that is, it must be a constant, function term or a variable that has been unified to a constant or function term.
-: at call time the respective argument must be free, that is, it must be a variable that has not been unified to a constant or function term.
?: at call time the respective argument may be either bound or free.
The documentation typically specifies invocation modes. Upon successful completion of a call it is generally assumed that all arguments of the call are non-variable (
+). Other result modes should be explicitly documented.
Note that "non-variable") is weaker than "variable-free". For instance, the term “
classT(Id,Pack,Name,Members)” is non-variable but it is not variable-free since it contains the variables
A Prolog predicate is said to be deterministic for a given invocation mode if every call to it that respects this mode succeeds only once. Otherwise, it is non-deterministic.
For instance, the append/3 predicate is deterministic if invoked with non-variable terms in the first two parameters or with a non-variable term in the third parameter. However, if invoked with a nonvariable term only in the first parameter it is nondeterministic, returning upon backtracking an infinite number of results (all possible extensions of the first list).
Deterministic invocation modes are indicated by
is det after the invocation mode. Non-deterministic modes are indicated by
append(+First:list, +Second:list, ?Third:list) is det append(?First:list, ?Second:list, +Third:list) is det append(+First:list, ?Second:list, ?Third:list) is nondet
Prolog does no static typechecking. However, for documentation purposes, in all the predicate specifications that you find on this website, arguments are annotated like this
mypredicate(+First:list, +Second:atom, ?Third:id, ?Fourth:term) is det
with the following types listed:
If there is no annotation it is just because the documentation is incomplete. Please help us by updating it (if you have write access to these pages) or otherwise, by asking us to do so.
In some parts of the documentation the above notation is replaced by some other conventions (sorry for the temporary inconsistency):
So the above example could also appear as
mypredicate(+[First], +'Second', ?#Third, ?Fourth:term) is det