Previous Up Next

Chapter 2  Terminology

This chapter defines the terminology which is used throughout the manual and in related documentation.
This denotes an input argument. Such an argument must be instantiated before a built-in is called.

This denotes a ground argument. Such an argument must can be complex, but must be fully instantiated, i.e. not contain any variables.

This denotes an output argument. Such an argument must be not instantiated before a built-in is called.

This denotes an input or an output argument. Such an argument may be either instantiated or not when a built-in is called.

Arity is the number of arguments to a term. Atoms are considered as functors with zero arity. The notation Name/Arity is used to specify a functor of name Name with arity Arity.

An arbitrary name chosen by the user to represent objects from the problem domain. A Prolog atom corresponds to an identifier in other languages.

An atom, string or a number. A terms which does not contain other terms.

A clause body can either be of the form
Goal_1, Goal_2, ..., Goal_k
or simply
Each Goal_i must be a callable term.

Built-in Procedures
These are predicates provided for the user by the ECLiPSe system, they are either written in Prolog or in the implementation language (usually “C”).

See program clause or goal.

Callable Term
A callable term is either a compound term or an atom.

Compound Term
Compound terms are of the form
f(t_1, t_2, ..., t_n)
where f is the functor of the compound term and t_i are terms, n is its arity. Lists and Pairs are also compound terms.

The determinism specification of a built-in or library predicate says how many solutions the predicate can have, and whether it can fail. The six determinism groups are defined as follows:
                |   Maximum number of solutions
    Can fail?   |   0               1               > 1
    no          |   erroneous       det             multi
    yes         |   failure         semidet         nondet
This classification is borrowed from the Mercury programming language, but in ECLiPSe only used for the purpose of documentation. Note that the determinism of a predicate usually depends on its calling mode.

A predicate mode is a particular instantiation pattern of its arguments at call time. Such a pattern is usually written as a predicate template, e.g.
where the symbols +, ++, − and ? represent instantiated, ground, uninstantiated and unknown arguments repsectively.

Each atom created within ECLiPSe is assigned a unique identifier called the dictionary identifier or DID.

Difference List
A difference list is a special kind of a list. Instead of being ended by nil, a difference list has an uninstantiated tail so that new elements can be appended to it in constant time. A difference list is written as List - Tail where List is the beginning of the list and Tail is its uninstantiated tail. Programs that use difference lists are usually more efficient and always much less readable than programs without them.

Dynamic Procedures
These are procedures which can be modified clause-wise, by adding or removing one clause at a time. Note that this class of procedure is equivalent to interpreted procedures in other Prolog systems. See also static procedures.

External Procedures
These are procedures which are defined in a language other than Prolog, and explicitly connected to Prolog predicates by the user.

A fact or unit clause is a term of the form:
where Head is a structure or an atom. A fact may be considered to be a rule whose body is always true.

A functor is characterised by its name which is an atom, and its arity which is its number of arguments.

Goal Clause
See query.

A term is ground when it does not contain any uninstantiated variables.

A head is a structure or an atom.

A variable is instantiated when it has been bound to an atomic or a compound term as opposed to being uninstantiated or free. See also ground.

A list is a special type of term within Prolog. It is a recursive data structure consisting of pairs (whose tails are lists). A list is either the atom [] called nil as in LISP, or a pair whose tail is a list. The notation :
[a , b , c]
is shorthand for:
[a | [b | [c | []]]]

The notation Name/Arity is used to specify a functor of name Name with arity Arity.

A pair is a compound term with the functor ./2 (dot) which is written as :
H is the head of the pair and T its tail.

A predicate is another term for a procedure.

This is similar to the notation Name/Arity. Some built-ins allow the arity to be omitted and to specify Name only. This stands for all (visible) predicates with that name and any arity.

Program Clause
A program clause or clause is either the term
Head :- Body.
i.e. a compound term with the functor :-/2, or only a fact.

A query has the same form as Body and is also called a goal. Such clauses occur mainly as input to the top level Prolog loop and in files being compiled, then they have the form
:- Goal_1, ..., Goal_k.
?- Goal_1, ..., Goal_k.

Regular Prolog Procedure
A regular (Prolog) procedure is a sequence of user clauses whose heads have the same functor, which then identifies the user procedure.

Simple Procedures
Apart from regular procedures ECLiPSe recognises simple procedures which are written not in Prolog but in the implementation language, i.e. C and which are deterministic. There is a functor associated with each simple procedure, so that any procedure recognisable by ECLiPSe is identified by a functor, or a compound term with this functor (or atom).

The SpecList notation means a sequence of terms of the form:
name_1/a_1, name_2/a_2, ..., name_k/a_k.
The SpecList notation is used in many built-ins, for example, to specify a list of procedures in the export/1 predicate.

Static Procedures
These are procedures which can only be changed as a whole unit, i.e. removed or replaced.

This is an I/O channel identifier and can be a physical stream number, one of the pre-defined stream identifiers (input, output, error, warning_output, log_output, null) or a user defined stream name (defined using set_stream/2 or open/3).

Compound terms which are not pairs are also called structures.

A term is the basic data type in Prolog. It is either a variable, a constant, i.e. an atom, a number or a string, or a compound term.
The notation Pred/N1, N2 is often used in this documentation as a shorthand for Pred/N1, Pred/N2.

Previous Up Next