Mode Annotations

A new system of representing the modes of arguments has been adapted in Release 3, is described in mpg. The library, including IPC, is still documented under the old system of mode annotations:

Each predicate definition is headed by a goal template such as

     setof(?X,+Goal,-Set)
     

Here X and the others are meta-variables, which name the arguments so that we don't have to keep saying "its first argument" and so on. The characters that precede the meta-variables will seem familiar if you know the mode declarations of DEC-10 Prolog; their significance is as follows:


+
This argument is an input to the predicate. It must initially be instantiated; otherwise, the predicate raises an error exception.
-
This argument is an output. It is returned by the predicate. That is, the output value is unified with any value that was supplied for this argument. The predicate fails if this unification fails. If no value is supplied, the predicate succeeds, and the output variable is unified with the return value.
?
This argument does not fall into either of the above categories. It is not necessarily an input nor an output, and it need not be instantiated.

Note that it is not an error to call a predicate with a - argument already instantiated. The value supplied will simply be unified with the result returned, and if that unification fails, the predicate fails.