Quintus Prolog Manual


(PREV) (NEXT)

l-1: Reading the Reference pages

l-1-1: Mode Annotations

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 which 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:

+
Input argument. This argument will be inspected by the predicate, and affects the behavior of the predicate, but will not be further instantiated by the predicate. An exception is raised if the argument isn't of the expected type. Note that the type class of an input arguments might include var.
-
Deterministic output argument. This argument is unified with the output value of the predicate. An output argument is only tested to be of the same type as the possible output value, if the type is simple (see {manual(l-1-3-1)}), and such testing is helpful to the user. Given the input arguments, the value of a deterministic output argument is uniquely defined.
*
Nondeterministic output argument. This argument is unified with the output value of the predicate. An output argument is only tested to be of the same type as the possible output value, if the type is simple (see {manual(l-1-3-1)}), and such testing is helpful to the user. The predicate might be resatisfiable, and might through backtracking generate more than one output value for this argument.
+-
An input argument that deterministically might be further instantiated by the predicate. Since it is an input argument, an exception will be raised if it isn't in the expected domain.
+*
An input argument that might be further instantiated by the predicate. The predicate might be resatisfiable, and might through backtracking generate more than one instantiation pattern for this argument. Since it is an input argument, an exception will be raised if it isn't in the expected domain.

If the synopsis of a predicate has more than one mode declaration, the first (the topmost) that satisfies both modes and 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.

l-1-2: Predicate Categories

This section describes the categories of predicates and how they are indicated in the reference pages for predicates of each given category. The names of categories hookable, hook, extendible, declaration, and meta-logical appear to the right of the title of the reference page.

Meta-predicates and operators are recognizable by the implicit conventions described below.

l-1-3: Argument Types

The argument section describes the type/domain of each argument. If it is a '+' argument, then the built-in always tests if the argument is the right type/domain. In some cases, types/domains mentioned in the Arguments section need not be the smallest set of all acceptable arguments.

l-1-3-1: Simple Types

The simple argument types are those for which type tests are provided. They are summarized in {manual(l-2-23)}. In addition there is stream_object, a special type of term described in {manual(g-7-6-1)}. If an output argument is given the type var, it means that that argument is not used by the predicate in the given instantiation pattern.

l-1-3-2: Extended Types

Following is a list of argument types which are defined in terms of the simple argument types. This is a formal description of the types/domains used in the Arguments sections of the reference pages for the built-ins. The rules are given in BNF (Backus-Naur form). term ::- (any Prolog term) list ::- list of Type ::- arity ::- (X <= 255)} char ::- pair ::- simple_pred_spec ::- pred_spec ::- pred_spec_tree ::- pred_spec_forest ::- gen_pred_spec ::- gen_pred_spec_tree ::- gen_pred_spec_tree_var ::- atoms also can be variables} extern_spec ::- extern_arg} extern_arg ::- foreign_spec ::- foreign_arg} foreign_arg ::- interf_arg_type ::- term | string | address file_spec ::- file_spec} expr ::- is/2; see the description of arithmetic expressions in {manual(g-8-3)}.} 2]: Exceptions:

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. ", ELSE "" }


Copyright (C) 1997 AI International Ltd
contact: product support sales information