The mode annotations are useful to tell whether an argument is input or output or both. They also describe formally the instantiation pattern to the call that makes the call to the built-ins determinate.
The mode annotations in the above example are ‘+’ and ‘-’. Following is a complete description of the mode annotations you will find in the reference pages:
If the synopsis of a predicate has more than one mode declaration, the first (the topmost) that satisfies the types (of a goal instance) is the one to be applied (to that goal instance).
All built-in predicates of arity zero are determinate
(with the exception of repeat/0
).
For input arguments, an exception will be raised if the argument isn't of the specified type.
For output arguments, an exception might be raised if the argument is nonvar, and not of the specified type. The generated value of the argument will be of the specified type.