General Core

DRAFT TECHNICAL CORRIGENDUM 2

Draft technical corrigendum 2 to International Standard 13211-1:1995 (E) was prepared by Joint Technical Committee ISO/IEC JTC 1, Information technology

This document is prepared in fulfillment of WG 17 resolutions A1, A2, A5, A6, A7, A8 in Edinburgh, 2010. References in brackets refer to the corresponding sections.

Additional corrections:A 1. Resolved that the missing error corresponding to a call to open/3,4 in which the stream variable is instantiated be called uninstantiation_error and that a corrigendum to this effect be submitted. [C1] A 2. Resolved that the predicates in the following list, compare/3, sort/2, keysort/2, ground/1, call/2-8, false/0, callable/1, subsumes_term/2, acyclic_term/1, term_variables/2, and retractall/1, unaccountably omitted from part 1 but present in most implementations be added as corrigenda. [C3, C4, C5, C6, C8, C9] A 6. Resolved that the evaluable functors on the following list be added by means of a corrigendum: (+)/1, max/2, min/2, acos/1, asin/1, tan/1, pi/0, xor/2 (as functor only), atan2/2, (^)/2, and (div)/2. [C14, C15, C16, C17] A 7. Resolved to change 6.3.4.3 of part 1 to allow the bar character | as an operator, but only if its precedence is greater than or equal to 1001. [C2] A 8. Resolved to change 6.3.4.3 to forbid the creation of operators called '{}' or '[]'. [C2]

- Error condition for retract/1. [C7]
- Error conditions of number_chars/2 et al.. [C10]
- Error conditions for evaluating an expression. [C11]
- Typo in call/1 example. [C12]
- Template and modes, and error conditions of catch/3. [C13]

- Incorrect example for write_canonical/1 [C18]

C1

`variable`

from the enumerated
set `ValidType`

.k) There shall be an Uninstantiation Error when an argument or one of its components is not a variable, and a variable or a component as variable is required. It has the form`uninstantiation_error(Culprit)`

where`Culprit`

is the argument or one of its components which caused the error.

5 When a built-in predicate has a single mode and template,

an argument whose mode is`-`

is always associated with an error

condition:a type errorwhen the argument is not a variable.

a type error

an uninstantiation error

- f) Stream is not a variable

—`type_error(variable, Stream).`

- f) Stream is not a variable

—`uninstantiation_error(Stream).`

C2

A bar (6.4) shall be equivalent to the atom`'|'`

when`'|'`

is an operator.

`op =`

`bar ;`

Abstract: `|`

Priority: nnSpecifier: ssCondition: `'|'`

is an operator

There shall not be an operator`'{}'`

or`'[]'`

.

An operator`'|'`

shall be only an infix operator with priority greater than or equal to 1001.

Bar is also a solo character (6.5.3), and a token (6.4) but not an atom.

3 The third argument of`op/3`

(8.14.3) may be any atom

except ',' so the priority of the comma operator cannot be

changed.

3 The third argument of`op/3`

(8.14.3) may be any atom except`','`

,`'[]'`

, and`'{}'`

so the priority of the comma operator cannot be changed, and so empty lists and curly bracket pairs cannot be declared as operators.

bar (* 6.4 *) = [ layout text sequence (* 6.4.1 *) ] , bar token (* 6.4.8 *) ;

bar token (* 6.4.8 *) = bar char (* 6.5.3 *) ;

`solo char`

:| bar char (* 6.5.3 *)

bar char (* 6.5.3 *) = "|" ;

l)`Op_specifier`

is a specifier such that`Operator`

would have an invalid set of specifiers (see 6.3.4.3).

—`permission_error(create, operator, Operator).`

l)`Operator`

is an atom,`Priority`

is a priority, and`Op_specifier`

is a specifier such that`Operator`

would have an invalid set of priorities and specifiers (see 6.3.4.3).

—`permission_error(create, operator, Operator).`

m)`Operator`

is a list,`Priority`

is a priority, and`Op_specifier`

is a specifier such that an element`Op`

of the list`Operator`

would have an invalid set of priorities and specifiers (see 6.3.4.3).

—`permission_error(create, operator, Op).`

op(500, xfy, {}). permission_error(create, operator, {}). op(500, xfy, [{}]). permission_error(create, operator, {}). op(1000, xfy, '|'). permission_error(create, operator, '|'). op(1000, xfy, ['|']). permission_error(create, operator, '|'). op(1150, fx, '|'). permission_error(create, operator, '|'). op(1105,xfy,'|'). Succeeds, making | a right associative infix operator with priority 1105. op(0,xfy,'|'). Succeeds, making | no longer an infix operator.

C3

## 8.2.4 subsumes_term/2

This built-in predicate provides a test for syntactic one-sided unification.## 8.2.4.1 Description

`subsumes_term(General, Specific)`

is true iff there is a substitutionθsuch that

- a)
`General`

θand`Specific`

θare identical, and- b)
`Specific`

θand`Specific`

are identical.

Procedurally,`subsumes_term(General, Specific)`

simply succeeds or fails accordingly. There is no side effect or unification.## 8.2.4.2 Template and modes

`subsumes_term(@@term, @@term)`

## 8.2.4.3 Errors

None.## 8.2.4.4 Examples

subsumes_term(a, a). Succeeds. subsumes_term(f(X,Y), f(Z,Z)). Succeeds. subsumes_term(f(Z,Z), f(X,Y)). Fails. subsumes_term(g(X), g(f(X))). Fails. subsumes_term(X, f(X)). Fails. subsumes_term(X, Y), subsumes_term(Y, f(X)). Succeeds.

- NOTES
- 1 The final two examples show that
`subsumes_term/2`

is not transitive. A transitive definition corresponding to the term-lattice partial order is`term_instance/2`

(3.95). term_instance(Term, Instance) :- copy_term(Term, Copy), subsumes_term(Copy, Instance). term_instance(g(X), g(f(X))). Succeeds.- 2 Many existing processors implement a built-in predicate
`subsumes/2`

which unifies the arguments. This often leads to erroneous programs. The following definition is mentioned only for backwards compatibility. subsumes(General, Specific) :- subsumes_term(General, Specific), General = Specific.

C4

## 8.3.9 callable/1

## 8.3.9.1 Description

`callable(Term)`

is true iff`Term`

is a callable term (3.24).

- NOTE — Not every callable term can be converted to the body of a clause, for example
`(1,2)`

.## 8.3.9.2 Template and modes

`callable(@@term)`

## 8.3.9.3 Errors

None.## 8.3.9.4 Examples

callable(a). Succeeds. callable(3). Fails. callable(X). Fails. callable((1,2)). Succeeds.## 8.3.10 ground/1

## 8.3.10.1 Description

`ground(Term)`

is true iff`Term`

is a ground term (3.82).## 8.3.10.2 Template and modes

`ground(@@term)`

## 8.3.10.3 Errors

None.## 8.3.10.4 Examples

ground(3). Succeeds. ground(a(1, _)). Fails.## 8.3.11 acyclic_term/1

## 8.3.11.1 Description

`acyclic_term(Term)`

is true iff`Term`

is acyclic, that is, it is a variable or a term instantiated (3.96) with respect to the substitution of a set of equations not subject to occurs check (7.3.3).## 8.3.11.2 Template and modes

`acyclic_term(@@term)`

## 8.3.11.3 Errors

None.## 8.3.11.4 Examples

acyclic_term(a(1, _)). Succeeds. X = f(X), acyclic_term(X). Undefined. [STO 7.3.3, does not succeed in many implementations, but fails, produces an error, or loops]

C5

`pair`

to the set `ValidType`

.`order`

to the set `ValidDomain`

.These built-in predicates compare and sort terms based on the ordering of terms (7.2).

## 8.4.2 compare/3 – three-way comparison

## 8.4.2.1 Description

`compare(Order, X, Y)`

is true iff`Order`

unifies with`R`

which is one of the following atoms:`'='`

iff`X`

and`Y`

are identical terms (3.87),`'<'`

iff`X`

term_precedes`Y`

(7.2), and`'>'`

iff`Y`

term_precedes`X`

.

Procedurally,`compare(Order, X, Y)`

is executed as follows:

- a) If
`X`

and`Y`

are identical, then let`R`

be the atom`'='`

and proceeds to 8.4.2.1 d.- b) Else if
`X`

term_precedes`Y`

(7.3), then let`R`

be the atom`'<'`

and proceeds to 8.4.2.1 d.- c) Else let
`R`

be the atom`'>'`

.- d) If
`R`

unifies with`Order`

, then the goal succeeds.- e) Else the goal fails.
## 8.4.2.2 Template and modes

`compare(-atom, ?term, ?term)`

`compare(+atom, @@term, @@term)`

## 8.4.2.3 Errors

- a)
`Order`

is neither a variable nor an atom

—`type_error(atom, Order).`

- b)
`Order`

is an atom but not`<`

,`=`

, or`>`

—`domain_error(order, Order).`

## 8.4.2.4 Examples

compare(Order, 3, 5). Succeeds, unifying Order with (<). compare(Order, d, d). Succeeds, unifying Order with (=). compare(Order, Order, <). Succeeds, unifying Order with (<). compare(<, <, <). Fails. compare(1+2, 3, 3.0). type_error(atom, 1+2). compare(>=, 3, 3.0). domain_error(order, >=).## 8.4.3 sort/2

## 8.4.3.1 Description

`sort(List, Sorted)`

is true iff`Sorted`

unifies with the sorted list of`List`

(7.1.6.5).

Procedurally,`sort(List, Sorted)`

is executed as follows:

- a) Let
`SL`

be the sorted list of list`List`

(7.1.6.5).- b) If
`SL`

unifies with`Sorted`

, then the goal succeeds.- c) Else the goal fails.

- NOTE — The following definition defines the logical and procedural behaviour of
`sort/2`

when no error conditions are satisfied and assumes that`member/2`

is defined as in 8.10.3.4. sort([], []). sort(List, Sorted) :- setof(X, member(X,List), Sorted). /* 8.10.3, 8.10.3.4 */## 8.4.3.2 Template and modes

`sort(@@list, -list)`

`sort(+list, +list)`

## 8.4.3.3 Errors

- a)
`List`

is a partial list

—`instantiation_error.`

- b)
`List`

is neither a partial list nor a list

—`type_error(list, List).`

- c)
`Sorted`

is neither a partial list nor a list

—`type_error(list, Sorted).`

## 8.4.3.4 Examples

sort([1, 1], Sorted). Succeeds, unifying Sorted with [1]. sort([1+Y, z, a, V, 1, 2, V, 1, 7.0, 8.0, 1+Y, 1+2, 8.0, -a, -X, a], Sorted). Succeeds, unifying Sorted with [V, 7.0, 8.0, 1, 2, a, z, -X, -a, 1+Y, 1+2] sort([X, 1], [1, 1]). Succeeds, unifying X with 1. sort([1, 1], [1, 1]). Fails. sort([V], V). Undefined. [STO 7.3.3, corresponds to the goal [V] = V. In many implementations this goal succeeds and violates the mode sort(@@list, -list).] sort([f(U),U,U,f(V),f(U),V],L). Succeeds, unifying L with [U,V,f(U),f(V)] or [V,U,f(V),f(U)]. [The solution is implementation dependent.]## 8.4.4 keysort/2

## 8.4.4.1 Description

`keysort(Pairs, Sorted)`

is true iff`Pairs`

is a list of compound terms with principal functor`(-)/2`

and`Sorted`

unifies with a permutation`KVs`

of`Pairs`

such that the`Key`

entries of the elements`Key-Value`

of`KVs`

are in weakly increasing term order (7.2). Elements with an identical`Key`

appear in the same relative sequence as in`Pairs`

.

Procedurally,`keysort(Pairs, Sorted)`

is executed as follows:

- a) Let
`Ts`

be the sorted list (7.1.6.5) containing as elements terms`t(Key, P, Value)`

for each element`Key-Value`

of`Pairs`

with`P`

such that`Key-Value`

is the`P`

-th element in`Pairs`

.- b) Let
`KVs`

be the list with elements`Key-Value`

occurring in the same sequence as elements`t(Key, _, Value)`

in`Ts`

.- c) If
`KVs`

unifies with`Sorted`

, then the goal succeeds.- d) Else the goal fails.

- NOTE — The following definition defines the logical and procedural behaviour of
`keysort/2`

when no error conditions are satisfied. The auxiliary predicate`numbered_from/2`

is not needed in many existing processors because`Ps`

happens to be a sorted list of variables. keysort(Pairs, Sorted) :- pairs_ts_ps(Pairs, Ts, Ps), numbered_from(Ps,1), sort(Ts, STs), /* 8.4.3 */ pairs_ts_ps(Sorted, STs, _). pairs_ts_ps([], [], []). pairs_ts_ps([Key-Value|Pairs], [t(Key,P,Value)|Ts], [P|Ps]) :- pairs_ts_ps(Pairs, Ts, Ps). numbered_from([], _). numbered_from([I0|Is], I0) :- I1 is I0 + 1, numbered_from(Is, I1).## 8.4.4.2 Template and modes

`keysort(@@list, -list)`

`keysort(+list, +list)`

## 8.4.4.3 Errors

- a)
`Pairs`

is a partial list

—`instantiation_error.`

- b)
`Pairs`

is neither a partial list nor a list

—`type_error(list, Pairs).`

- c)
`Sorted`

is neither a partial list nor a list

—`type_error(list, Sorted).`

- d) An element of a list prefix of
`Pairs`

is a variable

—`instantiation_error.`

- e) An element
`E`

of a list prefix of`Pairs`

is neither a variable nor a compound term with principal functor`(-)/2`

—`type_error(pair, E).`

- f) An element
`E`

of a list prefix of`Sorted`

is neither a variable nor a compound term with principal functor`(-)/2`

—`type_error(pair, E).`

## 8.4.4.4 Examples

keysort([1-1, 1-1], Sorted). Succeeds unifing Sorted with [1-1, 1-1]. keysort([2-99, 1-a, 3-f(_), 1-z, 1-a, 2-44], Sorted). Succeeds unifying Sorted with [1-a, 1-z, 1-a, 2-99, 2-44, 3-f(_)]. keysort([X-1,1-1],[2-1,1-1]). Succeeds unifying X with 2. Pairs = [1-2|Pairs], keysort(Pairs, Sorted). Undefined. [STO 7.3.3. type_error(list, [1-2,1-2,...]) or loops in many implementations.] keysort([V-V], V). Undefined. [STO 7.3.3, corresponds to the goal [V-V] = V. In many implementations this goal succeeds and violates the mode keysort(@@list, -list).]

C6

## 7.1.1.5 Witness variable list of a term

The witness variable list of a term`T`

is a list of variables and a witness of the variable set (7.1.1.2) of`T`

. The variables appear according to their first occurrence in left-to-right traversal of`T`

.

- NOTES
- 1 For example,
`[X, Y]`

is the witness variable list of each of the terms`f(X,Y)`

,`X+Y+X+Y`

,`X+Y+X`

, and`X*Y+X*Y`

.- 2 The concept of a witness variable list of a term is required when defining
`term_variables/2`

(8.5.5).## 8.5.5 term_variables/2

## 8.5.5.1 Description

`term_variables(Term, Vars)`

is true iff`Vars`

unifies with the witness variable list of`Term`

(7.1.1.5).

Procedurally,`term_variables(Term, Vars)`

is executed as follows:

- a) Let
`TVars`

be the witness variable list of`Term`

(7.1.1.5).- b) If
`Vars`

unifies with`TVars`

, then the goal succeeds.- c) Else the goal fails.

- NOTE — The order of variables in
`Vars`

ensures that, for every term`T`

, the following goals are true: term_variables(T, Vs1), term_variables(T, Vs2), Vs1 == Vs2. term_variables(T, Vs1), term_variables(Vs1, Vs2), Vs1 == Vs2.## 8.5.5.2 Template and modes

`term_variables(@@term, -list)`

`term_variables(?term, ?list)`

## 8.5.5.3 Errors

- a)
`Vars`

is neither a partial list nor a list

—`type_error(list, Vars).`

## 8.5.5.4 Examples

term_variables(t, Vars). Succeeds, unifying Vars with []. term_variables(A+B*C/B-D, Vars). Succeeds, unifying Vars with [A, B, C, D]. term_variables(t, [_, _|a]). type_error(list, [_, _|a]). S=B+T, T=A*B, term_variables(S, Vars). Succeeds, unifying Vars with [B, A], T with A*B, and S with B+A*B. T=A*B, S=B+T, term_variables(S, Vars). Same answer as above example. term_variables(A+B+B, [B|Vars]). Succeeds, unifying A with B and Vars with [B]. term_variables(X+Vars, Vars), Vars = [_, _]. Undefined. [STO 7.3.3, corresponds to the goal [X, Vars] = Vars.]

C7

—`permission_error(access, static_procedure, Pred).`

—`permission_error(modify, static_procedure, Pred).`

C8

## 8.9.5 retractall/1

## 8.9.5.1 Description

`retractall(Head)`

is true.

Procedurally,`retractall(Head)`

is executed as follows:

- a) Searches sequentially through each dynamic user-defined procedure in the database and removes all clauses whose head unifies with
`Head`

, and the goal succeeds.

- NOTES
- 1 The dynamic predicate remains known to the system as a dynamic predicate even when all of its clauses are removed.
- 2 Many existing processors define
`retractall/1`

as follows. retractall(Head) :- retract((Head :- _)), fail. retractall(_).## 8.9.5.2 Template and modes

`retractall(@@callable_term)`

## 8.9.5.3 Errors

- a)
`Head`

is a variable

—`instantiation_error.`

- b)
`Head`

is neither a variable nor a callable term

—`type_error(callable, Head).`

- c) The predicate indicator
`Pred`

of`Head`

is that of a static procedure

—`permission_error(modify, static_procedure, Pred).`

## 8.9.5.4 Examples

The examples defined in this subclause assume the database has been created from the following Prolog text::- dynamic(insect/1). insect(ant). insect(bee). retractall(insect(bee)). Succeeds, retracting the clause 'insect(bee)'. retractall(insect(_)). Succeeds, retracting all the clauses of predicate insect/1. retractall(insect(spider)). Succeeds. retractall(mammal(_)). Succeeds. retractall(3). type_error(callable, 3). retractall(retractall(_)). permission_error(modify, static_procedure, retractall/1).

C9

## 8.15.4 call/2..8

These built-in predicates provide support for higher-order programming.

- NOTE — A built-in predicate
`apply/2`

was implemented in some processors. Most uses can be directly replaced by`call/2..8`

.## 8.15.4.1 Description

`call(Closure, Arg1, ...)`

is true iff`call(Goal)`

is true where`Goal`

is constructed by appending`Arg1`

, ... additional arguments to the arguments (if any) of`Closure`

.

Procedurally, a goal of predicate`call/N`

with`N`

≥ 2. is executed as follows:

- a) Let
`call(p(X`

be the goal to be executed,_{1},...,X_{M}), Y_{2}, ..., Y_{N})`M`

≥ 0,- b) Execute
`call(p(X`

instead._{1}, ..., X_{M}, Y_{2}, ..., Y_{N}))## 8.15.4.2 Template and modes

`call(+callable_term, ?term, ...)`

## 8.15.4.3 Errors

- a)
`Closure`

is a variable

—`instantiation_error.`

- b)
`Closure`

is neither a variable nor a callable term

—`type_error(callable, Closure).`

- c) The number of arguments in the resulting goal exceeds the implementation defined maximum arity (7.11.2.3)

—`representation_error(max_arity).`

- d)
`call/N`

is called with`N`

≥ 9 and it shall be implementation dependent whether this error condition is satisfied

—`existence_error(procedure,call/N).`

- e)
`Goal`

cannot be converted to a goal

—`type_error(callable, Goal).`

- NOTE — A standard-conforming processor may implement call/N in one of the following ways because error condition d is implementation dependent (3.91).

- 1) Implement only the seven built-in predicates
`call/2`

up to`call/8`

.- 2) Implement
`call/2..N`

up to any`N`

that is within`8..max_arity`

(7.11.2.3). Produce existence errors for larger arities below`max_arity`

.- 3) Implement
`call/9`

and above only for certain execution modes.## 8.15.4.4 Examples

call(integer, 3). Succeeds. call(functor(F,c), 0). Succeeds, unifying F with c. call(call(call(atom_concat, pro), log), Atom). Succeeds, unifying Atom with prolog. call(;, X = 1, Y = 2). Succeeds, unifying X with 1. On re-execution, succeeds, unifying Y with 2. call(;, (true->fail), X=1). Fails. The following examples assume that maplist/2 is defined with the following clauses: maplist(_Cont, []). maplist(Cont, [E|Es]) :- call(Cont, E), maplist(Cont, Es). maplist(>(3), [1, 2]). Succeeds. maplist(>(3), [1, 2, 3]). Fails. maplist(=(X), Xs). Succeeds, unifying Xs with []. On re-execution, succeeds, unifying Xs with [X]. On re-execution, succeeds, unifying Xs with [X, X]. On re-execution, succeeds, unifying Xs with [X, X, X]. Ad infinitum.## 8.15.5 false/0

## 8.15.5.1 Description

`false`

is false.## 8.15.5.2 Template and modes

`false`

## 8.15.5.3 Errors

None.## 8.15.5.4 Examples

false. Fails.

C10

## 7.1.6.9 List prefix of a term

`LP`

is a list prefix of a term`P`

if:

- a)
`LP`

is an empty list, or- b)
`P`

is a compound term whose principal functor is the list constructor and the heads of`LP`

and`P`

are identical, and the tail of`LP`

is a list prefix of the tail of`P`

.

- NOTE — For example,
`[]`

,`[1]`

, and`[1,2]`

are all list prefixes of`[1,2,3]`

,`[1,2|X]`

, and`[1,2|nonlist]`

.

- a)
`Atom`

is a variable and`List`

is a partial list.

—`instantiation_error.`

- c)
`List`

is neither a partial list nor a list

—`type_error(list, List).`

- d)
`Atom`

is a variable and an element of a list prefix of`List`

is a variable.

—`instantiation_error.`

- e) An element
`E`

of a list prefix of`List`

is neither a variable nor a one-char atom

—`type_error(character, E).`

- a)
`Atom`

is a variable and`List`

is a partial list.

—`instantiation_error.`

- c)
`List`

is neither a partial list nor a list

—`type_error(list, List).`

- d)
`Atom`

is a variable and an element of a list prefix of`List`

is a variable.

—`instantiation_error.`

- e) An element
`E`

of a list prefix of`List`

is neither a variable nor an integer

—`type_error(integer, E).`

- f) An element of a list prefix of
`List`

is neither a variable nor a character code

—`representation_error(character_code).`

- a)
`Number`

is a variable and`List`

is a partial list.

—`instantiation_error.`

- c)
`List`

is neither a partial list nor a list

—`type_error(list, List).`

- d)
`Number`

is a variable and an element of a list prefix of`List`

is a variable.

—`instantiation_error.`

- f) An element
`E`

of a list prefix of`List`

is neither a variable nor a one-char atom

—`type_error(character, E).`

- a)
`Number`

is a variable and`List`

is a partial list.

—`instantiation_error.`

- c)
`List`

is neither a partial list nor a list

—`type_error(list, List).`

- d)
`Number`

is a variable and an element of a list prefix of`List`

is a variable.

—`instantiation_error.`

- f) An element
`E`

of a list prefix of`List`

is neither a variable nor an integer

—`type_error(integer, E).`

- g) An element of a list prefix of
`List`

is neither a variable nor a character code

—`representation_error(character_code).`

C11

- i) The value of an argument Culprit is not a member of the set
I

—`type_error(integer, Culprit).`

- j) The value of an argument Culprit is not a member of the set
F

—`type_error(float, Culprit).`

- i)
`E`

is a compound term with no corresponding operator in step 7.9.1 c but there is an operator corresponding to the same principal functor with different types such that

- a) the
i-th argument of the corresponding operator has type`Type`

, and- b) the value
`Culprit`

of thei-th argument of`E`

has a different type

—`type_error(Type, Culprit).`

C12

b(X) :- Y = (write(X), X), call(Y).

b(3). Outputs '3', then type_error(callable, 3).

b(3). type_error(callable, (write(3),3)).

C13

## 7.8.9.2 Template and modes

`catch(+callable_term, ?term, ?term)`

## 7.8.9.3 Errors

- a)
`G`

is a variable

—`instantiation_error.`

- b)
`G`

is neither a variable nor a callable term

—`type_error(callable, G)`

## 7.8.9.2 Template and modes

`catch(goal, ?term, goal)`

## 7.8.9.3 Errors

None.

C14

Priority Specifier Operator(s) 400 `yfx`

`div`

200 `fy`

`+`

Evaluable functor Operation `(div)/2`

intfloordiv_{I}`(+)/1`

pos,_{I}pos_{F}

`'div'`

to enumeration in Note. Add to Note:'+', '-' are prefix predefined operators.

intfloordiv:_{I}I×I→I∪ {int_overflow, zero_divisor}

pos_{I}: I → I

intfloordiv(_{I}x,y)= ⌊ x/y⌋if y≠ 0 ∧ ⌊x/y⌋ ∈I= int_overflowif y≠ 0 ∧ ⌊x/y⌋ ∉I= zero_divisorif y= 0

pos_{I}(x) = x

pos_{F}: F → F

pos_{F}(x) = x

C15

## 9.3.8 max/2 – maximum

## 9.3.8.1 Description

`max(X, Y)`

evaluates the expressions`X`

and`Y`

with values`VX`

and`VY`

and has the value of the maximum of`VX`

and`VY`

. If`VX`

and`VY`

have the same type then the valueRsatisfiesR∈ {`VX`

,`VY`

}.

If`VX`

and`VY`

have different types then let`VI`

and`VF`

be the values of type integer and float. The valueRshall satisfyR∈ {`VI`

,`float(VI)`

,`VF`

,undefined}

and the value shall be implementation dependent.

- NOTE — The possible values of
`float(VI)`

include the exceptional valuefloat_overflow∉F(9.1.6).## 9.3.8.2 Template and modes

max(float-exp, float-exp) = float max(float-exp, int-exp) = number max(int-exp, float-exp) = number max(int-exp, int-exp) = integer## 9.3.8.3 Errors

- a)
`X`

is a variable

—`instantiation_error.`

- b)
`Y`

is a variable

—`instantiation_error.`

- c)
`VX`

and`VY`

have different type and it shall be implementation dependent whether this error condition is satisfied

—`evaluation_error(undefined).`

- d)
`VX`

and`VY`

have different type and one of them is an integer`VI`

withfloat(_{I→F}`VI`

) =float_overflow(9.1.6) and it shall be implementation dependent whether this error condition is satisfied

—`evaluation_error(float_overflow).`

## 9.3.8.4 Examples

max(2, 3). Evaluates to 3. max(2.0, 3). Evaluates to 3, 3.0, or evaluation_error(undefined). [The result is implementation dependent.] max(2, 3.0). Evaluates to 3.0 or evaluation_error(undefined). [The result is implementation dependent.] max(0, 0.0). Evaluates to 0, 0.0, or evaluation_error(undefined). [The result is implementation dependent.]## 9.3.9 min/2 – minimum

## 9.3.9.1 Description

`min(X, Y)`

evaluates the expressions`X`

and`Y`

with values`VX`

and`VY`

and has the value of the minimum of`VX`

and`VY`

. If`VX`

and`VY`

have the same type then the valueRsatisfiesR∈ {`VX`

,`VY`

}.

If`VX`

and`VY`

have different types then let`VI`

and`VF`

be the values of type integer and float. The valueRshall satisfyR∈ {`VI`

,`float(VI)`

,`VF`

,undefined}

and the value shall be implementation dependent.

- NOTE — The possible values of
`float(VI)`

include the exceptional valuefloat_overflow∉F(9.1.6).## 9.3.9.2 Template and modes

min(float-exp, float-exp) = float min(float-exp, int-exp) = number min(int-exp, float-exp) = number min(int-exp, int-exp) = integer## 9.3.9.3 Errors

- a)
`X`

is a variable

—`instantiation_error.`

- b)
`Y`

is a variable

—`instantiation_error.`

- c)
`VX`

and`VY`

have different type and it shall be implementation dependent whether this error condition is satisfied

—`evaluation_error(undefined).`

- d)
`VX`

and`VY`

have different type and one of them is an integer`VI`

withfloat(_{I→F}`VI`

) =float_overflow(9.1.6) and it shall be implementation dependent whether this error condition is satisfied

—`evaluation_error(float_overflow).`

## 9.3.9.4 Examples

min(2, 3). Evaluates to 2. min(2, 3.0). Evaluates to 2, 2.0, or evaluation_error(undefined). [The result is implementation dependent.] min(2.0, 3). Evaluates to 2.0 or evaluation_error(undefined). [The result is implementation dependent.] min(0, 0.0). Evaluates to 0, 0.0, or evaluation_error(undefined). [The result is implementation dependent.]## 9.3.10 (^)/2 – integer power

## 9.3.10.1 Description

`^(X, Y)`

evaluates the expressions`X`

and`Y`

with values`VX`

and`VY`

and has the value of`VX`

raised to the power of`VY`

. If`VX`

and`VY`

are both zero then the value shall be one.## 9.3.10.2 Template and modes

^(int-exp, int-exp) = integer ^(float-exp, int-exp) = float ^(int-exp, float-exp) = float ^(float-exp, float-exp) = float

- NOTE — '^' is an infix predefined operator (see 6.3.4.4).
## 9.3.10.3 Errors

- a)
`X`

is a variable

—`instantiation_error.`

- b)
`Y`

is a variable

—`instantiation_error.`

- c)
`VX`

is negative and`VY`

is neither an integer nor a float with an integer value.

—`evaluation_error(undefined).`

- d)
`VX`

is zero and`VY`

is negative

—`evaluation_error(undefined).`

- e)
`VX`

and`VY`

are integers and`VX`

is not equal to 1 and`VY`

is less than -1.

—`type_error(float, VX).`

- f)
`VX`

or`VY`

is a float and the magnitude of`VX`

raised to the power of`VY`

is too large

—`evaluation_error(float_overflow).`

- g)
`VX`

or`VY`

is a float and the magnitude of`VX`

raised to the power of`VY`

is too small and not zero

—`evaluation_error(underflow).`

## 9.3.10.4 Examples

^(0,0). Evaluates to 1. 3^1.0. Evaluates to 3.0. 3^3. 27. 3^27. Evaluates to 7625597484987. 3^3^3. Evaluates to 7625597484987. 2^(-1). evaluation_error(undefined). 1^(-1). Evaluates to 1. 0^0. Evaluates to 1. 2^ -1.5. Evaluates to a value approximately equal to 0.353553.## 9.3.11 asin/1 – arc sine

## 9.3.11.1 Description

`asin(X)`

evaluates the expression`X`

with value`VX`

and has the principal value of the arc sine of`VX`

(measured in radians), that is, the valueRsatisfies

-π/2 ≤R≤ π/2## 9.3.11.2 Template and modes

asin(float-exp) = float asin(int-exp) = float## 9.3.11.3 Errors

- a)
`X`

is a variable

—`instantiation_error.`

- b)
`VX`

is greater than 1 or less than -1

—`evaluation_error(undefined).`

## 9.3.11.4 Examples

asin(0.5). Evaluates to a value approximately equal to 0.523599. 2*asin(1). Evaluates to a value approximately equal to 3.14159. asin(2). evaluation_error(undefined).## 9.3.12 acos/1 – arc cosine

## 9.3.12.1 Description

`acos(X)`

evaluates the expression`X`

with value`VX`

and has the principal value of the arc cosine of`VX`

(measured in radians), that is, the valueRsatisfies

0 ≤R≤ π## 9.3.12.2 Template and modes

acos(float-exp) = float acos(int-exp) = float## 9.3.12.3 Errors

- a)
`X`

is a variable

—`instantiation_error.`

- b)
`VX`

is greater than 1 or less than -1

—`evaluation_error(undefined).`

## 9.3.12.4 Examples

acos(-1). Evaluates to a value approximately equal to 3.14159. acos(0.5). Evaluates to a value approximately equal to 1.047197. acos(1.5). evaluation_error(undefined).## 9.3.13 atan2/2 – arc tangent

## 9.3.13.1 Description

`atan2(Y, X)`

evaluates the expressions`Y`

and`X`

with values`VY`

and`VX`

and has the principal value of the arc tangent of`VY/VX`

(measured in radians), using the signs of both arguments to determine the quadrant of the valueR, that is, the valueRsatisfies

-π ≤R≤ π## 9.3.13.2 Template and modes

atan2(int-exp, int-exp) = float atan2(float-exp, int-exp) = float atan2(int-exp, float-exp) = float atan2(float-exp, float-exp) = float## 9.3.13.3 Errors

- a)
`X`

is a variable

—`instantiation_error.`

- b)
`Y`

is a variable

—`instantiation_error.`

- c)
`X`

is equal to zero and`Y`

is equal to zero

—`evaluation_error(undefined).`

## 9.3.13.4 Examples

atan2(1,0). Evaluates to a value approximately equal to 1.570796. atan2(0,-1). Evaluates to a value approximately equal to 3.14159. atan2(0,0). evaluation_error(undefined).## 9.3.14 tan/1 – tangent

## 9.3.14.1 Description

`tan(X)`

evaluates the expression`X`

with value`VX`

and has the value of the tangent of`VX`

(measured in radians).## 9.3.14.2 Template and modes

tan(float-exp) = float tan(int-exp) = float## 9.3.14.3 Errors

- a)
`X`

is a variable

—`instantiation_error.`

## 9.3.14.4 Examples

tan(0.5). Evaluates to a value approximately equal to 0.5463.

C16

- 1 An error occurs if T is an atom or variable.

- 1 An error occurs if T is a variable or if there is no operation
Fin step 7.9.1 c).

## 9.3.15 pi/0 – pi

## 9.3.15.1 Description

`pi`

has the value of π which is the ratio of a circle's circumference to its diameter.## 9.3.15.2 Template and modes

pi = float## 9.3.15.3 Errors

None.## 9.3.15.4 Examples

pi Evaluates to a value approximately equal to 3.14159.

C17

## 9.4.6 xor/2 – bitwise exclusive or

## 9.4.6.1 Description

`xor(B1, B2)`

evaluates the expressions`B1`

and`B2`

with values`VB1`

and`VB2`

and has the value such that each bit is set iff exactly one of the corresponding bits in`VB1`

and`VB2`

is set.

The value shall be implementation defined if`VB1`

or`VB2`

is negative.## 9.4.6.2 Template and modes

xor(int-exp, int-exp) = integer## 9.4.6.3 Errors

- a)
`B1`

is a variable

—`instantiation_error.`

- b)
`B2`

is a variable

—`instantiation_error.`

- c)
`B1`

is not a variable and`VB1`

is not an integer

—`type_error(integer, VB1).`

- d)
`B2`

is not a variable and`VB2`

is not an integer

—`type_error(integer, VB2).`

## 9.4.6.4 Examples

xor(10, 12). Evaluates to the value 6. xor(125, 255). Evaluates to the value 130. xor(-10, 12). Evaluates to an implementation defined value.

(informative)

Issues still to be resolved

C18

`write_canonical/1`

does not correspond to
7.10.5 Writing a term. The functor `('.')/2`

is written in
functional notation as `.(H,T)`

and not
as `'.'(H,T)`

(three times). The constant `[]`

is written with a space between the opening and closing bracket. It
should be written without the space, because 7.10.5 d demands that it
is output "as the sequence of characters defined by the syntax for the
atom (6.1.2b, 6.4.2)". 7.10.5 f demands for `'.'`

(H,T)
that the atom of the principal functor is output. That means
that `'.'`

is now written according to 7.10.5 d. Since a
single unquoted `'.'`

is misread as the
nonterminal `end`

it must be quoted. In many situations,
it could be disambiguated by using round brackets. However, only
quoting is allowed in 7.10.5 d.write_canonical([1,2,3]). Succeeds, outputting the characters .(1,.(2,.(3,[ ]))) to the current output stream.

write_canonical([1,2,3]). Succeeds, outputting the characters '.'(1,'.'(2,'.'(3,[]))) to the current output stream.

(informative)

Editorial notes

- All error subclauses (X.Y.Z.3) starting with C1: Mdash: —
- C3 8.2.4.1: Theta: θ
- C5 8.4.2: Ndash: –
- C14 9.1.3:
- Times: ×
- Rightwards arrow: →
- Union: ∪
- Floor: ⌊ ⌋
- Inequality: ≠
- Logical and: ∧
- Element of, not in: ∈, ∉

- C15 9.3.11.1, 9.3.12.1, 9.3.13.1, C16:
- Pi: π
- Less or equal: ≤

Ulrich Neumerkel (editor)

Institut für Computersprachen E185/1

TU Wien

Argentinierstr. 8

A-1040 Wien

Austria

Telephone: +43 1 58801 18513

E-Mail: Ulrich.Neumerkel@@tuwien.ac.at

August - December 2010

Validated HTML @ 1.107 log @Changes *after* N4626 @ text @d773 1 a773 1 Succeeds, unifying Sorted with [1]. @ 1.106 log @Very final edit @ text @d773 1 a773 1 Succeeds unifies Sorted with [1]. d793 1 a793 1 Succeeds unifying L with [U,V,f(U),f(V)] or d1175 1 a1175 1

`term_variables/2`

.
d1568 1
a1568 1
In this manner all errors of the goal can be caught by catch/3
@
1.104
log
@Forgotten E
@
text
@d1394 2
a1395 3
`Atom`

is a variable and either `List`

is a
partial list or an element of a list prefix of `List`

is a variable.
@
1.103
log
@Split error condtion a of number_chars/2 (4 times)
@
text
@d1378 2
a1379 2
`List`

is neither a
variable nor a one-char atom
d1424 1
a1424 1
`E`

of a list prefix of `List`

@
1.102
log
@Remove ambiguity in error condition a for number_chars(1, [C])
and 3 others
@
text
@d1359 1
a1359 1
`Atom`

is a variable and either `List`

is a
partial list or an element of a list prefix of `List`

is a variable.
d1373 6
a1378 1
`List`

is neither a
d1389 1
a1389 1
`E`

of a list prefix of `List`

d1424 1
a1424 1
`Number`

is a variable and either `List`

is a
partial list or an element of a list prefix of `List`

is
a variable.
d1439 6
a1444 1
`E`

of a list prefix of `List`

d1455 1
a1455 1
`Number`

is a variable and either `List`

is a
partial list or an element of the list prefix of `List`

is a variable.
d1470 6
a1475 1
`E`

of a list prefix of `List`

d1480 1
a1480 1
`List`

is neither a
@
1.101
log
@Introduced Else if
@
text
@d1364 1
a1364 1
`Atom`

is a variable and `List`

is a
d1390 1
a1390 1
`Atom`

is a variable and `List`

is a
d1421 1
a1421 1
`Number`

is a variable and `List`

is a
d1448 1
a1448 1
`Number`

is a variable and `List`

is a
@
1.100
log
@m
@
text
@d652 1
a652 1
`X`

`Y`

(7.3), then
d656 1
a656 1
`R`

be the atom `'>'`

.
@
1.99
log
@Make procedural definition of compare/3 clearer. Roger Scowen
@
text
@d656 1
a656 1
`R`

be the atom `'>'`

.
@
1.98
log
@Simple changes. Roger Scowen
@
text
@d648 3
a650 6
`R`

be the atom
`'='`

, `'<'`

, or `'>'`

if `X`

and `Y`

are
identical, `X`

`Y`

(7.3),
or
`Y`

`X`

respectively.
d652 7
a658 1
`R`

unifies with `Order`

, then the
d661 1
a661 1
`'<'`

iff `X`

`Y`

(7.3), and
d1017 1
a1017 1
Same answer.
d1337 1
a1337 1
the list prefix of the tail of `P`

.
d1693 1
a1693 1
`max(X, Y)`

evaluates the expression `X`

and
d1775 1
a1775 1
`min(X, Y)`

evaluates the expression `X`

and
@
1.96
log
@post N4587
@
text
@d139 1
a139 1
`KVs`

unifies with `Sorted`

, then the
d967 1
a967 1
`TVars`

be the list of variables
d1218 4
@
1.93
log
@Better example for callable/1
@
text
@d2344 1
a2344 1
August - November 2010 @ 1.92 log @Formatting for Word @ text @d521 1 a521 1 body of a clause, for example

`(1,1)`

.
d545 1
a545 1
callable((1,1)).
@
1.91
log
@Back - this should be the real final version
@
text
@d89 1
a89 1
d93 1 a93 1

d175 1 a175 1

*Remove in subclause b variable from the enumerated
d178 1
a178 1
*

*Add additional error class:*
d273 1
a273 1

*
d415 1
a415 1
*

*
d436 3
a438 2
*

*Procedurally, subsumes_term(General, Specific)
simply succeeds or fails accordingly. There is no side effect or
d507 1
a507 1
*

*
d627 1
a627 1
*

*
d642 1
a642 1
*

*
d712 1
a712 1
*

*
d808 1
a808 1
*

*
d930 1
a930 1
*

*
d961 2
a962 1
*

*
d1054 1
a1054 1
*

*
d1065 2
a1066 1
*

*Procedurally, retractall(Head) is executed as follows:
d1156 1
a1156 1
*

*
d1178 2
a1179 1
*

*Procedurally, a goal of predicate call/N
d1316 1
a1316 1
*

*
d1602 1
a1602 1
*

*Add in Table 7 - The operator table:*
d1680 1
a1680 1

*
d1695 1
a1695 1
*

*
d1777 1
a1777 1
*

*
d2150 1
a2150 1
*

*
d2186 1
a2186 1
*

*
d2202 1
a2202 1
*

*
d2261 1
a2261 1
*

*
@
1.90
log
@Style removed
@
text
@d10 67
@
1.89
log
@Missed PRE
@
text
@a9 67
@
1.88
log
@Final html
@
text
@d81 1
a81 1
PRE-DRAFT TECHNICAL CORRIGENDUM 2
@
1.87
log
@Actual delivery draft
@
text
@d10 67
@
1.86
log
@Final
@
text
@d6 1
a6 1
Pre-Draft technical corrigendum 2
a9 67
@
1.85
log
@Further example added
@
text
@d87 1
a87 1
Currently under preparation!
a89 1
a92 1
d139 3
a153 3
*

Remove in subclause b `variable`

from the enumerated
set.
d178 1
a178 1

Add additional error class:
d193 1
a193 1
Replace in Note 5
d201 1
a201 1
the words
d207 1
a207 1
by
d215 1
a215 1
Replace error condition f
d227 1
a227 1
by
d248 1
a248 1
Add prior to syntax rules:
d255 1
a255 1
Add the syntax rule:
d267 1
a267 1
Add at the end of 6.3.4.3 before NOTES:
d279 1
a279 1
Add to note 1
d286 1
a286 1
Replace note 3
d294 1
a294 1
by
d305 1
a305 1
Add as the last syntax rule:
d317 1
a317 1
Add as the last syntax rule:
d328 2
a329 1
Add alternative for `solo char`

:
d336 1
a336 1
Add as the last syntax rule:
d345 1
a345 1
Replace
d355 1
a355 2
by
d368 1
a368 1
Add additional error:
d382 1
a382 1
Add the following examples:
d416 1
a416 1
Add the new subclauses into the place indicated by their number:
d507 1
a507 1
Add the new subclauses into the place indicated by their number
d610 1
a610 1
Add `pair`

to the set `ValidType`

.
d614 1
a614 1
Add `order`

to the set `ValidDomain`

.
d618 2
a619 2
Move the two paragraphs from subclause 8.4 to subclause 8.4.1.
Add into subclause 8.4:
d627 1
a627 1
Add the new subclauses into the place indicated by their number:
a766 3
d912 2
a913 2
[STO 7.3.3. type_error(list, [1-2,1-2,...]) or loops
in many implementations.]
d917 4
a920 7
[STO 7.3.3, corresponds to the goal [V-V] = V. In
many implementations this goal succeeds and
violates the mode keysort(@@list, -list).]
d930 1
a930 1
Add the new subclauses into the place indicated by their number:
d1032 1
a1032 1
Replace in error condition c
d1040 1
a1040 1
by
d1053 1
a1053 1
Add the new subclauses into the place indicated by their number:
d1154 1
a1154 1
Add the new subclauses into the place indicated by their number:
d1313 1
a1313 1
Add the new sublauses into the place indicated by their number:
d1348 1
a1348 1
Replace error condition a, c, and d by:
d1374 1
a1374 1
Replace error condition a, c, and d. Add error conditon f.
d1404 1
a1404 1
Replace error condition a, c, and d by:
d1431 1
a1431 1
Replace error conditions a, c, and d. Add error condition f.
d1467 2
a1468 2
Replace error condition i and j (which both were added in Technical
Corrigendum 1)
d1482 1
a1482 1
by
d1512 1
a1512 1
For program
d1519 1
a1519 1
replace
d1529 1
a1529 1
by
d1545 1
a1545 1
Replace
d1569 1
a1569 1
by
d1598 1
a1598 1

Add in Table 7 - The operator table:
d1610 1
a1610 1
Add to table:
d1620 1
a1620 1
Add `'div'`

to enumeration in Note. Add to Note:
d1628 1
a1628 1
Add specifications:
d1639 1
a1639 1
Add as axioms:
d1659 1
a1659 1
Add specification:
d1665 1
a1665 1
Add as axiom:
d1677 1
a1677 1
Add the new subclauses into the place indicated by their number:
d1944 1
a1944 1

`write_canonical/1`

does not correspond to
d2271 1
a2271 1
quoting is allowed in 7.10.5 d.
d2275 1
a2275 1
Replace
d2286 1
a2286 1
by
d2305 16
a2320 9
`f(X,Y)`

, `X+Y+X`

,
and `X*X+Y*X`

.
@
1.83
log
@*** empty log message ***
@
text
@d484 1
@
1.82
log
@Added anchors
@
text
@d97 2
a98 1
A5, A6, A7, A8 in Edinburgh, 2010:
d105 1
a105 1
[1C2C2C10111213718atan2/2, (^)/2, and (div)/2.
d129 1
a129 1
is greater than or equal to 1001.
d132 1
a132 1
called '{}' or '[]'.
d141 1
d144 1
d147 1
d150 1
d153 1
d163 1
@
1.80
log
@*** empty log message ***
@
text
@d153 1
d226 1
d395 1
d484 1
d587 1
d914 1
d1016 1
d1037 1
d1138 1
d1297 1
d1451 1
d1496 1
d1528 1
d1579 1
d1660 1
d2110 1
d2165 1
d2239 1
@
1.79
log
@*** empty log message ***
@
text
@d141 9
d2216 1
d2220 24
d2245 19
@
1.78
log
@*** empty log message ***
@
text
@d706 1
a706 1
setof(X, member(X,List), Sorted). /* 8.10.3 */
a2215 3
Version control d2228 1 a2228 1

`E`

of the partial list or
list `Sorted`

is neither a variable nor a compound term with
@
1.76
log
@*** empty log message ***
@
text
@d137 2
d144 2
a145 2
d900 2 a901 3Add built-in predicate term_variables/2 and retractall/1 (Part of resolution A2, Edinburgh 2010), related minor correction for retract/1d1001 3 a1003 1## 8.9.3.3 Errors (retract/1)

d1021 4 d1118 11 d1279 1 a1279 1Correct error conditions of atom_chars/2, atom_codes/2, d1432 1 a1432 1Correct error conditions for evaluating an expression.d1476 1 a1476 1Correct example for call/1d1507 1 a1507 1Adjust Template and Modes of catch/3, remove error xconditions. d1557 4 a1560 4Add evaluable functors (+)/1 (unary plus) and (div)/2 (flooring integer division) to simple arithmetic functors (9.1). Add operators corresponding to (-)/1 and (//)/2 (integer division) (Part of resolution A6, Edinburgh 2010)d1637 1 a1637 1Add evaluable functors max/2, min/2, (^)/2, asin/1, acos/1, d2085 2 a2086 1Add evaluable atom pi/0 (Part of resolution A6, Edinburgh d2103 1 a2103 11 An error occurs if T is a variable and if there is no d2140 1 a2140 1 Add evaluable functor xor/2 (Part of resolution A6, Edinburgh d2143 3 @ 1.75 log @Min added. Klaus Däßler @ text @d844 1 a844 1d)`Pairs`

is a list with an element which is a variable d848 3 a850 3e) An element`E`

of the partial list or list`Pairs`

is neither a variable nor a compound term with principal functor`(-)/2`

d1341 2 a1342 2f) An element of a list prefix of`List`

is neither a variable nor a character code d1367 2 a1368 2d) An element`E`

of a list prefix of`List`

is neither a variable nor a one-char atom d1394 2 a1395 2d) An element`E`

of a list prefix of`List`

is neither a variable nor an integer d1399 2 a1400 2f) An element of a list prefix of`List`

is neither a variable nor a character code d1615 1 a1615 1 atan2/2, tan/1, pi/0, xor/2 (Part of resolution A6, Edinburgh a1704 4 @@@@@@idem a1788 2 @@@@@@ Shall this be defined for floats or not? d1801 3 a1803 3 ^(float-exp, int-exp) = float @@@@@@ ^(int-exp, float-exp) = float @@@@@@ ^(float-exp, float-exp) = float @@@@@@ d1823 1 a1823 1 integer nor a float with an integer value. @@@@@@ d1870 1 a1870 1 Evaluates to 0.5 or error @@@@@@. d1873 1 a1873 1 Evaluates to 1 or 1.0 or error @@@@@@. d1880 1 a1880 1 equal to 0.353553 or evaluation_error(undefined). @@@@@@ d2060 29 d2114 5 d2227 1 a2227 1

August - September 2010 @ 1.74 log @*** empty log message *** @ text @d1706 3 d1710 80 a1789 1 @@@@@@idem @ 1.73 log @catch/3 change is fix @ text @d135 1 a135 1Template and modes, and error conditions of catch/3. @ 1.72 log @Renumbering - Ulrich Geske @ text @d135 2 d1483 48 a2072 41 ## 7.8.9

Replaceby## 7.8.9.2 Template and modes

`catch(+callable_term, ?term, ?term)`

## 7.8.9.3 Errors

- a)
`G`

is a variable

—`instantiation_error.`

- b)
`G`

is neither a variable nor a callable term

—`type_error(callable, G)`

@ 1.71 log @*** empty log message *** @ text @d1711 1 a1711 1## 7.8.9.2 Template and modes

`catch(goal, ?term, goal)`

## 7.8.9.3 Errors

None.e) `VX`

or`VY`

is a float and the magnitude d1717 1 a1717 1f) `VX`

or`VY`

is a float and the magnitude @ 1.70 log @*** empty log message *** @ text @d2078 1 a2078 1Rightwards arrow: → d2085 1 a2085 1 Pi, Theta: &pi, θ @ 1.69 log @*** empty log message *** @ text @d1291 1 a1291 1 ## 8.16.4.3 Errors (atom_chars/2)

d1317 1 a1317 1## 8.16.5.3 Errors (atom_codes/2)

d1319 1 a1319 1 Replace error condition a, c, and d by: d1339 1 a1339 1e) An element of a list prefix d1347 1 a1347 1 ## 8.16.7.3 Errors (number_chars/2)

d1374 1 a1374 1## 8.16.8.3 Errors (number_codes/2)

d1376 1 a1376 1 Replace error conditions a, c, and d by: d1397 1 a1397 1e) An element of a list prefix of @ 1.68 log @*** empty log message *** @ text @d1299 1 a1299 1 partial list or an element of the list prefix of `List`

d1308 2 a1309 2d) An element `E`

of the partial list or list`List`

is neither a variable nor a one-char atom d1325 1 a1325 1 partial list or an element of the list prefix of`List`

d1334 2 a1335 2d) An element `E`

of the partial list or list`List`

is neither a variable nor an integer d1339 2 a1340 2e) An element `E`

of the partial list or list`List`

is neither a variable nor a character code d1356 1 a1356 1 partial list or an element of the list prefix of`List`

is d1365 2 a1366 2d) An element `E`

of the partial list or list`List`

is neither a variable nor a one-char atom d1392 2 a1393 2d) An element `E`

of the partial list or list`List`

is neither a variable nor an integer d1397 2 a1398 2e) An element `E`

of the partial list or list`List`

is neither a variable nor a character code @ 1.67 log @List prefix @ text @d1276 1 a1276 1

`[]`

, `[1]`

,
and `[1,2]`

are all list prefixes of `[1,2,3]`

,
`[1,2|X]`

,
and
d1286 3
a1289 1
@
1.66
log
@prefix list
@
text
@d1265 10
a1274 4
The list prefix of a term `T`

is the empty list, if T is
not a compound term whose principal functor is the list constructor.
The list prefix of a term `.(E, U)`

is a compound
term `.(E, W)`

with `W`

being the list prefix of `U`

.
d1278 9
@
1.65
log
@*** empty log message ***
@
text
@d900 1
a900 1
`G`

is neihter a variable nor a callable term
@
1.63
log
@*** empty log message ***
@
text
@d1963 47
a2009 1
(informative)

Editorial notes

`Culprit`

of the
`E`

has a type for which there is
no corresponding operator with that type in the `Type`

in
the
If `float(VI)`

∈ *F* and `VF`

> `float(VI)`

then the value *R* shall satisfy *R* ∈ {`VF`

, **undefined**}.
@@@@@@
@
1.59
log
@call/1 has precise (original) error
@
text
@d1539 2
a1540 2

`float(VX)`

and `float(VY)`

include the exceptional
@
1.58
log
@Mats Carlsson
@
text
@d133 1
a133 1
d1415 1 a1415 3 type_error(callable, (write(3),3)) or type_error(callable, 3). [The answer is implementation dependent.] a1418 23 Replace the final three example by:

- d)
`G`

cannot be converted to a goal and while executing the conversion (7.6.2) a term`T`

is not callable.

—`type_error(callable, T).`

@ 1.57 log @*** empty log message *** @ text @d342 1 a342 1 is a specifier such that an element of the list @ 1.56 log @*** empty log message *** @ text @d1753 1 a1753 1 satisfiescall((fail, 1)). type_error(callable, (fail, 1)) or type_error(callable, 1). [The answer is implementation dependent.] call((write(3), 1)). type_error(callable, (write(3), 1)) or type_error(callable, 1). [The answer is implementation dependent.] call((1;true)). type_error(callable, (1;true)) or type_error(callable, 1). [The answer is implementation dependent.]

-π/2 ≤

`retractall/1`

are as
@
1.50
log
@Stricter mode for sort/2 and keysort/2. Paulo Moura
@
text
@d779 3
a781 3
satisfied. In many implementations, the auxiliary
predicate `numbered_from/2`

is not needed,
since `Ps`

happens to be a sorted list of variables.
d1021 1
a1021 1
`retractall/1`

are as
@
1.49
log
@typo, Fred Mesnard
@
text
@d691 1
a691 1
`sort(+list, ?list)`

d806 1
a806 1
`keysort(+list, ?list)`

@
1.48
log
@Typo Mats Carlsson
@
text
@d896 1
a896 1
retractall(Head) :- retract((Head :- _)), fail. retractall(_). @ 1.43 log @*** empty log message *** @ text @d109 1 a109 2 (+)/1, max/2, min/2, acos/1, asin/1, tan/1, pi/0, xor/2 (as functor only), @ 1.42 log @Program error - which does not even show! Markus Triska @ text @d1168 1 a1168 1 of the following ways because the error in subclause d is implementation @ 1.41 log @*** empty log message *** @ text @d793 1 a793 1 pairs_ts_ps([Key-Value|Pairs], [t(Key,P,Value)|Ts], Ps) :- @ 1.40 log @*** empty log message *** @ text @d677 1 a677 1

`keysort/3`

when no error conditions are
@
1.38
log
@*** empty log message ***
@
text
@d678 1
a678 1
behaviour of `sort/3`

when no error conditions are
@
1.37
log
@WG17
@
text
@d678 1
a678 1
behaviour of `setof/3`

when no error conditions are
@
1.36
log
@*** empty log message ***
@
text
@d1610 2
a1649 12
@ 1.35 log @Pre-Jonathan @ text @a14 1 d130 2 d162 8 d182 1 a182 1 Replace in error condition f d186 3 d190 1 d198 2 d201 1 d331 1 a331 1 @@@@@@ or modify a343 1 @@@@@@ or modify d347 1 a347 14 @@@@@@ discuss usecatch(X is-1**1.5,error(E,_),true).

evaluation_error(undefined): SICStus, SWI, IF, ECLiPSe, Qu,

nan: GNU, YAP, B, CIAO, CX, XSB, H,

catch(X is-1**1.0,error(E,_),true).

`permission_error(modify, operator, _)`

instead, since currently `op(10, fx, ',')`

has two
different error conditions: j (modify) and l (create).
Con: the last example of 13211-1:1995, 8.14.3.4

op(30,xfy,++), op(50,yf,++).produces a permission_error(create, operator, _), in IF, GNU

No error in YAP, SICStus, B, Ciao, ECLiPSe, CX, XSB, H, Qu. But they consider this certainly as an implementation specific extension in the sense of 5.5.1 note.

`member/2`

is defined
as in 8.10.3.4.
sort([], []). sort(List, Sorted) :- setof(X, member(X,List), Sorted). /* 8.10.3 */d776 28 d846 3 a870 26

keysort(Pairs, Sorted) :- pairs_ts_ps(Pairs, Ts, Ps), numbered_from(Ps,1), sort(Ts, STs), /* 8.4.3 */ pairs_ts_ps(Sorted, STs, _). /* Auxiliary predicates, not defined */ pairs_ts_ps([], [], []). pairs_ts_ps([Key-Value|Pairs], [t(Key,P,Value)|Ts], Ps) :- pairs_ts_ps(Pairs, Ts, Ps). numbered_from([], _). numbered_from([I0|Is], I0) :- I1 is I0 + 1, numbered_from(Is, I1).

- NOTE — In many Prolog processors the goal
`numbered_from(Ps,1)`

is not needed, since Ps will be a sorted list of variables.

@ 1.34 log @*** empty log message *** @ text @d300 2 a303 1d316 1 d341 3 a343 1

—`permission_error(create, operator, Operator).`

a312 1

No error in YAP, SICStus, B, Ciao, ECLiPSe, CX, XSB, H, Qu.
d835 1
d843 2
@
1.33
log
@*** empty log message ***
@
text
@d297 3
a299 2
l) `Op_specifier`

is a specifier such that `Operator`

would have an invalid set of specifiers (see 6.3.4.3).
d302 2
d307 5
a311 3
l) `Priority`

is a priority and `Op_specifier`

is a specifier such that `Operator`

would have an
invalid set of priorities and specifiers (see 6.3.4.3).
d314 3
d321 4
a324 3
m) `Priority`

is a priority and `Op_specifier`

is a specifier such that an element of the `Operator`

list
would have an invalid set of priorities and specifiers (see 6.3.4.3).
d326 2
a327 1

— `permission_error(create, operator, Operator).`

d331 3
d335 4
d340 1
d537 2
a538 2
[STO, does not succeed in many implementations, but
fails, loops, or produces an error]
d560 2
a561 2
These built-in predicates test, compare, and sort terms based on
the ordering of terms (7.2).
d568 1
a568 1

`sort/2`

assumes
that `member/2`

is defined as in 8.10.3.4.
d728 1
a728 1
setof(X, member(X,List), Sorted).
d735 1
a735 1
`keysort(List, Sorted)`

is true iff `List`

is a
d738 1
a738 1
of `List`

such that the
d742 1
a742 1
relative sequence as in `List`

.
d745 1
a745 1
Procedurally, `keysort(List, Sorted)`

is executed as
d750 5
a754 5
`KNVs`

be the sorted list (7.1.6.5) containing
as elements terms `t(Key, N, Value)`

for each
element `Key-Value`

of `List`

with `N`

such that `Key-Value`

is
the `N`

-th element in `List`

.
d758 1
a758 1
elements `t(Key, N, Value)`

in `KNVs`

.
d776 1
a776 1
`List`

is a partial list
d780 1
a780 1
`List`

is neither a partial list nor a list
d782 1
a782 1
—

`type_error(list, List).`

d788 1
a788 1
`List`

is a list with an element which is a variable
d793 1
a793 1
list `List`

is neither a variable nor a compound term with
d816 1
a816 1
List = [1-2|List], keysort(List, Sorted).
d831 23
d866 1
a866 1
`T`

is a list of variables
d876 1
a876 1
`[X, Y]`

is the variable list of each of
d890 1
a890 1
unifies with the list of variables
d1348 1
a1348 1
—

`type_error(integer, Culprit)`

d1351 1
a1351 1
—

`type_error(float, Culprit)`

d1368 1
a1368 1
—

`type_error(Type, Culprit)`

d1545 1
a1545 1
[The actual result is implementation dependent]
d1549 1
a1549 1
[The actual result is implementation dependent]
d1553 1
a1553 1
[The actual result is implementation dependent]
d1574 3
a1576 3
^(float-exp, int-exp) = float
^(int-exp, float-exp) = float
^(float-exp, float-exp) = float
@
1.32
log
@op/3 undefining '|'
@
text
@d349 1
a349 2
Succeeds, make | no longer an
infix operator.
@
1.31
log
@(^)/2 improvements
@
text
@d347 4
@
1.30
log
@Add Pasadena 2009 resolution A1n
@
text
@d1524 1
a1524 1
zero, the value is `1`

or `1.0`

.
d1529 1
a1529 1
^(int-exp, int-exp) = int @@@@@@ or number
d1551 2
a1552 1
`VX`

is negative and `VY`

is not an integer
d1572 6
@
1.29
log
@(^)/2 tests
@
text
@d461 3
@
1.28
log
@*** empty log message ***
@
text
@d1552 12
d1612 1
@
1.27
log
@m
@
text
@d201 2
a202 1
A bar (6.4) shall be equivalent to the atom '|' when '|' is an operator.
d630 17
d726 1
a726 1
`KNVs`

(7.1.6.5) containing
d732 3
a734 3
`KVs`

with elements `Key-Value`

occurring in the same sequences as elements ```
t(Key, N,
Value
```

in `KNVs`

.
d736 2
a737 2
`KVs`

unifies with `Sorted`

, then the goal
succeeds.
d768 9
a776 2
`E`

of `List`

is neither a
variable nor a compound term with principal functor `(-)/2`

d859 1
a859 1
that, for every term `T`

, the following goals are true.
d1437 1
a1437 1
d1445 1 @ 1.26 log @Almost finished, (^)/2 open @ text @d418 2 a419 2 copy_term(Term, TermC), subsumes_term(TermC, Instance). @ 1.25 log @Nachm @ text @d11 5 d28 2 a29 1 max-width: 30em; d123 9 a131 2 Additioncal corrections: Error conditions of number_chars/2 and friends. d135 2 a136 2

d428 1 a428 1 deprecated and mentioned only for backwards compatibility. d492 3 a494 2 instantiated (3.96) with respect to the substitution of a set of equations not subject to occurs check (7.3.3). d518 2 a519 4

`pair`

to the set `ValidType`

.
d527 1
a527 1
Add `order`

to the set `ValidDomain`

.
d554 20
d677 12
d694 12
a705 2
list of compound terms `Sorted`

unifies with a list `KVs`

.
d708 5
a712 3
`KV`

is an element of `KVs`

iff `KV`

is an element of `List`

`KV1`

d714 3
a716 1
d718 2
d721 1
a721 1
d723 1
a723 9
`List`

is a
list of elements `Key-Value`

@@@@@@
and containing the elements
of `List`

sorted according to `Key`

`Sorted`

is a list
in ascending order of `Key`

following term order (7.2). The elements
of `List`

with the same key shall appear
in the same order the `Sorted`

list.
d764 3
d769 2
a770 2
[STO. type_error(list, [1-2,1-2,...]) or looping in
many implementations.]
d774 3
a776 3
[STO, corresponds to the goal [V-V] = V. In many
implementations this goal succeeds and violates
the mode keysort(@@list, -list).]
a781 1
d785 3
a787 1

d789 1 d798 1 a798 1 The variables appear according to their first occurence in d885 24 a914 1 a925 1 d992 1 d994 1 d996 3 a998 1 @@@@@@ unclear which one d1001 1 a1001 1 permission_error(modify, static_procedure, (:-)/2). d1003 14 a1016 1 @@@@@@ unclear which one d1069 3 a1071 3

`call/N`

is called with `N`

≥ 9. It
shall be implementation dependent whether or not this error condition
is satisfied.
d1168 3
a1170 6
`atom_chars/2`

,
`atom_codes/2`

,
`number_chars/2`

,
`number_codes/2`

`(+)/1`

(unary plus)
and `(div)/2`

(flooring integer division) to simple
arithmetic functors (9.1). Add operators corresponding
to `(-)/1`

and `(//)/2`

(integer division)d1407 7 a1413 5 If

`VX`

and `VY`

have different types then the
value `VX`

, `VY`

, `float(VX)`

, `float(VY)`

,
`VI`

and `VI`

)
= `1`

(@@@@@@ or 1.0).
d1500 1
a1500 1
^(int-exp, int-exp) = int
d1522 19
a1540 1
@@@@@@reconsider the errors of (**)/2.
d1550 3
d1561 13
d1857 1
@
1.24
log
@Tamas' first round!
@
text
@d117 3
d398 1
a398 1
term-lattice partial order is `term_instance/2`

(3.95):
d404 3
d638 1
a638 1
implementations this goal succeeds, thereby violating
d646 11
a656 2
`keysort(List, Sorted)`

is true iff `Sorted`

unifies with a list of@@@@@@
d717 1
a717 1
implementations this goal succees, thereby violating
d774 1
a774 1
that, for every term `T`

, the following goal is true.
d777 3
a779 3
term_variables(T, Vs1), term_variables(T, Vs2),
term_variables(Vs1, Vs3), term_variables(Vs2, Vs4),
Vs1 == Vs2, Vs1 == Vs3, Vs1 == Vs4.
d781 1
d1069 6
a1074 4
`atom_chars/2`

, `atom_codes/2`

, `number_chars/2`

, `number_codes/2`

`subsumes/2`

which binds the first argument to be identical to the second.
This binding often leads to erroneous programs.
The following definition is deprecated and mentioned
only for backwards compatibility.
d469 3
a471 3
`acyclic_term(Term)`

is true iff `Term`

is an acyclic
term, that is, `Term`

has been obtained by a finite set of
equations that are not subject to occurs-check (7.3.3).
d489 2
a490 2
[Does not succeed in most implementations, but fails,
loops, or produces an error]
d619 1
a619 1
8.0, +a, +X, a], Sorted).
d621 1
a621 1
[V, 7.0, 8.0, 1, 2, a, z, +X, +a, 1+Y, 1+2]
d631 3
a633 1
[STO, corresponds to the goal [V] = V.]
d646 8
a653 6
list of elements with the format `Key-Value`

and `Sorted`

is a list containing the elements
of `List`

sorted according to the value of `Key`

in ascending order following term order (7.2). The relative order
of elements of `List`

with the same key shall not change in
the `Sorted`

list.
d693 11
d722 1
a722 1
which is a witness of the variable set (7.1.1.2) of `T`

.
d757 10
d955 2
a956 2
shall be implementation dependent whether or not this error is
produced.
d958 1
a958 1
—

`existence_error(procedure,call/9).`

d964 1
a964 1
of the following ways because the error in subclause d is implement
d972 1
a972 1
`call/2..N`

up to any N that is within
d1060 1
a1060 1
Replace subclause c and d by:
d1080 1
a1080 1
Replace subclause c and d by:
d1248 1
a1248 1
If `VX`

and `VY`

are of same type then the
d1259 3
d1264 2
a1265 1
and `float(VY)`

include the exceptional value d146 1 a146 1d152 1 a152 1d160 1 a160 1d168 1 a168 1d185 1 a185 1d191 1 a191 1d203 1 a203 1d215 1 a215 1d222 1 a222 1d230 1 a230 1d241 1 a241 1d253 1 a253 1d263 1 a263 1d271 1 a271 1d280 1 a280 1d287 1 a287 1d295 1 a295 1d311 1 a311 1d338 1 a338 1d516 1 a516 1d524 1 a524 1d575 2 a576 2 compare(==, 3, 3.0). domain_error(order, ==). d582 1 a582 1d705 1 a705 1d932 3 a934 2d) `call/9`

is called. It is implementation dependent whether or not this error is produced. d1040 1 a1040 1d1047 2 a1048 2d) An element `E`

of the list`List`

is neither a variable nor a one-char atom d1060 1 a1060 1d1067 2 a1068 2d) An element `E`

of the list`List`

is neither a variable nor an integer code d1072 2 a1073 7e) An element `E`

of the list`List`

is neither a variable nor a character code

—`representation_error(character_code).`

@@@@@@ e) An element `E`

of the list`List`

is an integer but not a character code d1080 1 a1080 1## 8.16.6.3 Errors (char_code/2)

d1082 3 a1084 1 @@@@@@ Replace subclause d by: a1085 1d1088 1 a1088 2d) `Code`

is an integer but not a character code (7.1.2.2) d1090 6 a1095 1

—`representation_error(character_code).`

d1098 1 d1101 1 a1101 1 Pro: IF, GNU, YAP, SICStus, SWI, B, ECLiPSe, XSB. d1103 2 a1104 1## 8.16.7.3 Errors (number_chars/2)

d1106 1 a1106 1 Replace subclause c by: d1114 2 a1115 1 d1117 1 a1117 1## 8.16.7.3 Errors (number_codes/2)

d1119 2 a1120 1 Replace subclause c by: d1122 1 a1122 5

- c)
`List`

is neither a partial list nor a list

—`type_error(list, List).`

d1126 1 a1126 2 d1141 1 a1141 1d1153 1 a1153 1d1163 1 a1163 1d1171 1 a1171 1d1175 2 a1176 1d1182 1 a1182 1d1193 1 a1193 1d1202 1 a1202 1d1208 1 a1208 1d1217 1 a1217 1@ 1.21 log @HTML-formatting @ text @d833 1 a833 1

—`type_error(callable, Generate).`

d921 1 a921 1

—`instantiation error.`

@ 1.20 log @instance! by Feliks Kluzniak @ text @d7 65 d161 3 a163 1 —`type_error(variable, Stream).`

d169 3 a171 1 —`uninstantiation_error(Stream).`

d186 1 a186 1 A bar (6.4) shall be equivalent to the atom '|'

when '|' is an operator. d216 1 a216 1 Bar is also a solo character (6.5.3), and a token (6.4) but

d232 3 a234 3

except ',', '[]', and '{}' so the priority of the comma

operator cannot be changed, and so empty lists and curly

bracket pairs cannot be declared as operators. d289 1 a289 1 is a

specifier such that`Operator`

would have an

d296 1 d298 4 a301 2 is a

specifier such that an element of the`Operator`

list would have an invalid set of priorities and

specifiers (see 6.3.4.3). a302 2

—`permission_error(create, operator, Operator).`

d347 6 a352 4d389 1 a389 2`General`

θand`Specific`

θare identical, and

`Specific`

θand`Specific`

d354 1 a354 1NOTES d391 3 a393 1d539 1 a539 1

1 The final two examples show that`subsumes_term/2`

is d395 1 a395 1 term-lattice partial order is: d397 1 a397 1d403 1 a403 1

2 d410 2 a411 1d416 1 a416 1`compare(+atom, @@term, @@term) d545 3 a547 2`

- a)
`Order`

is neither a variable nor an atom

—`type_error(atom, Order).`

d551 3 a553 1`>`

—`domain_error(order, Order).`

d601 7 a607 1 list

—`instantiation_error.`

d609 1 a609 2- b)
`List`

is neither a partial list nor a list

—`type_error(list, List).`

d611 1 a611 2- c)
`Sorted`

is neither a partial list nor a list

—`type_error(list, Sorted).`

d663 7 a669 2- a)
`List`

is a partial list

—`instantiation_error.`

d671 1 a671 2- b)
`List`

is neither a partial list nor a list

—`type_error(list, List).`

d673 1 a673 2- c)
`Sorted`

is neither a partial list nor a list

—`type_error(list, Sorted).`

d676 1 d679 4 a682 3- e) An element
`E`

of`List`

is neither a variable nor a compound term with principal functor`(-)/2`

—`type_error(pair, E).`

d714 5 a718 5NOTESd736 3 a738 11 For example,

`[X, Y]`

is the variable list of each of the terms`f(X,Y)`

,`X+Y+X`

, d721 4 a724 42 The concept of a variable list of a term is required when defining

`term_variables/2`

a) Let`TVars`

be the list of variables d740 4 a743 2

b) If`Vars`

unifies with`TVars`

, then the goal succeeds.

c) Else the goal fails. d755 1 a804 1NOTES d806 3 a808 1

1 d810 1 a810 1 The dynamic predicate remains known to the system as a dynamic d814 2 a815 1

2 d817 1 a817 2 If no corresponding procedure was found, the database remains unaltered. @@@@@@ or not d827 5 a831 2- a)
`Head`

is a variable

—`instantiation_error.`

d833 1 a833 2- b)
`Head`

is neither a variable nor a callable term

—`type_error(callable, Generate).`

d836 3 a838 2 is that of a static procedure

—`permission_error(modify, static_procedure, Pred).`

d887 2 a888 2NOTE — A built-in predicated919 3 a921 2`apply/2`

was implemented d891 1 a891 1- a)
`Closure`

is a variable

—`instantiation error`

. d923 3 a925 2- b)
`Closure`

is neither a variable nor a callable term

—`type_error(callable, Closure)`

. d928 3 a930 2 implementation defined maximum arity (7.11.2.3)

—`representation_error(max_arity)`

. d933 3 a935 2 whether or not this error is produced.

—`existence_error(procedure,call/9)`

. d939 2 a940 2NOTE — A standard-conforming processor may implement call/N in one d943 1 a943 1 d957 1 a958 1d1042 3 a1044 2- c)
`List`

is neither a partial list nor a list

—`type_error(list, List).`

d1047 5 a1051 2 neither a variable nor a one-char atom

—`type_error(character, E).`

d1062 3 a1064 2- c)
`List`

is neither a partial list nor a list

—`type_error(list, List).`

d1067 3 a1069 2 neither a variable nor an integer code

—`type_error(integer, E).`

d1072 3 a1074 2 neither a variable nor a character code

—`representation_error(character_code).`

d1077 3 a1079 2 an integer but not a character code

—`representation_error(character_code).`

d1092 3 a1094 1 (7.1.2.2)

—`representation_error(character_code).`

d1107 3 a1109 2- c)
`List`

is neither a partial list nor a list

—`type_error(list, List).`

d1119 3 a1121 2- c)
`List`

is neither a partial list nor a list

—`type_error(list, List).`

d1236 2 a1237 2NOTE — The possible values of

`float(VX)`

d1239 1 d1254 5 a1258 1- a)
`X`

is a variable

—`instantiation_error.`

d1260 1 a1260 1- b)
`Y`

is a variable

—`instantiation_error.`

d1306 3 a1308 1 NOTE — '^' is an infix predefined operator (see 6.3.4.4). d1314 3 a1316 1- a)
`X`

is a variable

—`instantiation_error.`

d1318 3 a1320 1- b)
d1344 1 a1344 1`Y`

is a variable

—`instantiation_error.`

d1324 1 a1324 1## 9.3.1.1 Description

d1351 1 a1351 1## 9.3.1.2 Template and modes

d1358 1 a1358 1## 9.3.11.3 Errors

d1362 1 a1362 1- a)
`X`

is a variable

—`instantiation_error.`

d1364 5 a1368 2- b)
`VX`

is greater than 1 or less than -1

—`evaluation_error(undefined).`

d1372 1 a1372 1## 9.3.11.4 Examples

d1389 1 a1389 1## 9.3.12.1 Description

d1396 1 a1396 1## 9.3.12.2 Template and modes

d1403 1 a1403 1## 9.3.12.3 Errors

d1407 5 a1411 1- a)
`X`

is a variable

—`instantiation_error.`

d1413 1 a1413 2- b)
`VX`

is greater than 1 or less than -1

—`evaluation_error(undefined).`

d1417 1 a1417 1## 9.3.12.4 Examples

d1442 1 a1442 1## 9.3.13.2 Template and modes

d1455 1 a1455 1- a)
`X`

is a variable

—`instantiation_error.`

d1457 5 a1461 1- b)
`Y`

is a variable

—`instantiation_error.`

d1464 3 a1466 1 zero

—`evaluation_error(undefined).`

d1493 1 a1493 1## 9.3.14.2 Template and modes

d1500 1 a1500 1## 9.3.14.3 Errors

d1504 3 a1506 1- a)
`X`

is a variable

—`instantiation_error.`

d1510 1 a1510 1## 9.3.14.4 Examples

d1569 1 a1569 1- a)
`B1`

is a variable

—`instantiation_error.`

d1571 5 a1575 1- b)
`B2`

is a variable

—`instantiation_error.`

d1578 3 a1580 1 an integer

—`type_error(integer, VB1).`

d1583 3 a1585 1 an integer

—`type_error(integer, VB2).`

@ 1.19 log @*** empty log message *** @ text @d322 1 a322 1 term-lattice partial order would be d324 4 a327 3 subsumes_term_transitive(X, Y) :- copy_term(Y, YC), subsumes_term(X, YC). d399 2 a400 1 term. d536 3 d540 2 a541 1 sort([1+Y, z, a, V, 1, 2, V, 1, 7.0, 8.0, 1+Y, 1+2, 8.0, +a, +X, a], Sorted). d543 1 a543 1 [V, 7.0, 8.0, 1, 2, a, z, +X, +a, 1+Y, 1+2] d604 2 a605 1 Succeeds unifying Sorted with [1-a, 1-z, 1-a, 2-99, 2-44, 3-f(_)]. d607 4 @ 1.18 log @Markus Triska @ text @d320 3 a322 3

1`subsumes_term/2`

is not transitive. The last two examples above illustrate this. A transitive definition corresponding to the term-lattice partial order would be @ 1.17 log @*** empty log message *** @ text @d109 1 a109 1Allow bar character | as infix operator, forbid '{}' and '[] as d372 2 a373 1`ground(Term)`

is true iff`Term`

is a ground term. @ 1.16 log @Better modes for sort/2 and keysort/2 @ text @d546 1 a546 1 [STO, corresponds to the goal [V] = V] d645 1 @ 1.15 log @atom_chars/2 etc. Errors @ text @d513 1 d568 1 d977 1 a977 1 Pro: GNU, YAP, SICStus, SWI, B, ECLiPSe, XSB. @ 1.14 log @*** empty log message *** @ text @a600 3 d859 2 a860 2 Succeeds, unifying X with 1. On backtracking, it succeeds, unifying Y with 2. d916 86 d1456 1 a1456 1Dash: — @ 1.13 log @Comments from Feliks Kluzniak @ text @d829 1 a829 1 NOTE — A conforming processor may implement call/N in one @ 1.12 log @ndash @ text @d139 2 a140 2 There shall not be an operator '|' except as an

infix with priority greater than or equal to 1001. d170 1 a170 1 Add as last syntax rule: d182 1 a182 1 Add as last syntax rule: d200 1 a200 1 Add as last syntax rule: d829 3 a831 3 NOTE — Due to the error in subclause d being implementation dependent (3.91), a conforming processor may implement call/N in one of the following ways. d1021 1 a1021 1 If`VX`

and`VY`

are of different type then the d1057 1 a1057 1 Evaluates to 3, 3.0, or undefined. d1061 1 a1061 1 Evaluates to 3.0 or undefined. d1065 1 a1065 1 Evaluates to 0, 0.0, or undefined. @ 1.11 log @keysort errors @ text @d1009 1 a1009 1## 9.3.8 max/2 - maximum

d1070 1 a1070 1## 9.3.9 min/2 - minimum

d1073 1 a1073 1## 9.3.10 (^)/2 - integer power

d1122 1 a1122 1## 9.3.11 asin/1 - arc sine

d1164 1 a1164 1## 9.3.12 acos/1 - arc cosine

d1206 1 a1206 1## 9.3.13 atan2/2 - arc tangent

d1253 1 a1253 1## 9.3.14 tan/1 - tangent

d1284 1 a1284 1## 9.3.15 pi/0 - pi

d1309 1 a1309 1## 9.4.6 xor/2 - bitwise exclusive or

@ 1.10 log @Better modes and templates! @ text @d509 1 a509 1 unifies with the sorted list of list`List`

(7.1.6.5). d574 1 a574 2 list or a list with an element which is a variable

—`instantiation_error.`

d582 4 a585 1

d) An element`E`

of`List`

is neither @ 1.9 log @compare templace and modes @ text @d461 2 a462 1`compare(?atom, ?term, ?term)`

d513 1 a513 1`sort(?list, ?list)`

d567 1 a567 1`keysort(@@list, ?list)`

@ 1.8 log @subsumes_term/2 transitive definition note. John Gallagher @ text @d461 1 a461 1`compare(?atom, @@term, @@term)`

d761 1 a761 1 retractall(nonexistent), inexistant. d789 2 a790 2

`Procedurally, a goal of predicate`

be the goal to be executed, M ≥ 0, N ≥ 2. d855 1 a855 1 call(atom_concat(pro), log, Atom). @ 1.7 log @retractall/1 ambiguities @ text @d321 7 a327 1 examples above illustrate this. d704 1 a704 1 predicate. even when all of its clauses are removed. @ 1.6 log @retractall &ct @ text @d754 10 @ 1.5 log @sort/2 and keysort/2 got a home @ text @d341 2 a342 1`call/N`

is executed as follows: d795 1 a795 1 Y_{N})`callable(Term)`

is true iff`Term`

is a callable term. a683 2 @@@@@@ d686 4 a689 12

`P`

and
arity `N`

associated
with `Head`

. `P/N`

is the associated predicate
indicator
`P/N`

, then proceeds to 8.9.5.1 d,
`Head`

and the goal succeeds
d697 3
a699 2
The dynamic predicate shall continue to be known by the system
even when all of its clauses are removed.
d703 2
a704 2
This predicate leaves the referenced predicate dynamic even when all
of its clauses are removed.
d751 3
@
1.4
log
@*** empty log message ***
@
text
@d416 6
d424 1
d427 10
d492 102
d624 1
a624 1
unifies with `TVars`

which is the list of variables
a903 113
Add the new subclauses into the place indicated by their number:

## 8.x.y sort/2

@@@@@@determine x.y@@@@@@## 8.x.y.1 Description

`sort(List, Sorted)`

is true iff`Sorted`

unifies with the sorted list (7.1.6.5) of`List`

.## 8.x.y.2 Template and modes

`sort(?list, ?list)`

## 8.x.y.3 Errors

- a)
`List`

is a partial list

—`instantiation_error.`

- b)
`List`

is neither a partial list nor a list

—`type_error(list, List).`

- c)
`Sorted`

is neither a partial list nor a list

—`type_error(list, Sorted).`

## 8.x.y.4 Examples

sort([1+Y, z, a, V, 1, 2, V, 1, 7.0, 8.0, 1+Y, 1+2, 8.0, +a, +X, a], Sorted). Succeeds, unifying Sorted with [V, 7.0, 8.0, 1, 2, a, z, +X, +a, 1+Y, 1+2] sort([X, 1], [1, 1]). Succeeds, unifying X with 1. sort([1, 1], [1, 1]). Fails. sort([V], V). Undefined. [STO, corresponds to the goal [V] = V]## 8.x.z keysort/2

@@@@@@determine x.z@@@@@@## 8.x.z.1 Description

@@@@@@`keysort(List, Sorted)`

is true iff`Sorted`

unifies with a list of@@@@@@

`List`

is a list of elements with the format`Key-Value`

and`Sorted`

is a list containing the elements of`List`

sorted according to the value of`Key`

in ascending order following term order (7.2). The relative order of elements of`List`

with the same key shall not change in the`Sorted`

list.## 8.x.z.2 Template and modes

`keysort(@@list, ?list)`

## 8.x.z.3 Errors

- a)
`List`

is a partial list or a list with an element which is a variable

—`instantiation_error.`

- b)
`List`

is neither a partial list nor a list

—`type_error(list, List).`

- c)
`Sorted`

is neither a partial list nor a list

—`type_error(list, Sorted).`

- d) An element
`E`

of`List`

is neither a variable nor a compound term with principal functor`(-)/2`

—`type_error(pair, E).`

`pair`

to the set `ValidType`

.
Add the new subclauses into the place indicated by their number:
a988 2 d1043 1 a1043 1 Evaluates to 3 or 3.0. d1047 2 a1048 1 Evaluates to 3.0. d1051 1 a1051 1 Evaluates to 0 or 0.0. d1382 2 a1383 1## 8.x.z.4 Examples

keysort([2-99, 1-a, 3-f(_), 1-z, 1-a, 2-44], Sorted). Succeeds unifying Sorted with [1-a, 1-z, 1-a, 2-99, 2-44, 3-f(_)].

E185/1, TU Wien @ 1.3 log @Numbering corrected @ text @d535 1 a535 1 Succeeds, unifying Vars with [A,B,C,D]. d537 2 a538 2 term_variables(t, [_,_|a]). type_error(list, [_,_|a]). d541 1 a541 1 Succeeds, unifying Vars with [B,A], T with A*B, d550 1 a550 1 term_variables(Vars+Vars, Vars). d552 1 a552 1 [STO, corresponds to goal [Vars] = Vars.] d592 2 a593 4 This predicate does not change any of the standard predicate properties of the referenced predicate (as reported by

`predicate_property(Head, Property)`

), even when all of
its clauses are removed.
d744 1
a744 1
maplist(<(3), [1,2]).
d747 1
a747 1
maplist(<(3), [1,2,3]).
d756 1
a756 1
unifying Xs with [X,X].
d758 1
a758 1
unifying Xs with [X,X,X].
d820 3
a822 2
sort([1, 2, 1, 8, 4], Sorted).
Succeeds, unifying Sorted with [1, 2, 4, 8].
d826 7
d843 6
a848 1
`keysort(List, Sorted)`

is true iff `List`

is a
d875 2
a876 2
a variable nor a `(-)/2`

compound
term—

`type_error(pair, E).`

d905 1
a905 1
to `(-)/1`

and `(//)/1`

(integer division)`max(X, Y)`

evaluates the expression `X`

with
value `VX`

, the expression `Y`

with
value `VY`

, and has the value of the maximum
of `VX`

and `VY`

. When used with expressions of
mixed-types, the result is implementation dependent; an implementation
may chose either to return a value or to throw an exception.
d1026 1
a1026 2
`X`

is a variable or `Y`

is a
variable—

`instantiation_error.`

d1028 1
a1028 5
`X`

is not a variable and `VX`

is not a
number—

`type_error(number, VX).`

`Y`

is not a variable and `VY`

is not a
number—

`type_error(number, VY).`

d1073 1
a1073 1
NOTE - '^' is a right associative infix predefined operator (see 6.3.4.4).
d1077 10
d1091 10
a1100 5
Evaluates to 0.
^(7,7).
Evaluates to 823543.
7^7^7.
Evaluates to @@@@@@
a1102 1
d1125 1
a1125 4
`X`

is not a variable and `VX`

is not a
number—

`type_error(number, VX).`

`VX`

is greater than 1 or less than
a1160 1
d1167 1
a1167 4
`X`

is not a variable and `VX`

is not a
number—

`type_error(number, VX).`

`VX`

is greater than 1 or less than
d1193 1
a1193 1
arguments to determine the quadrant of the return value. The
d1210 1
a1210 5
`X`

is a variable or `Y`

is a
variable—

`instantiation_error.`

`X`

is not a variable and `VX`

is not a
number—

`type_error(number, VX).`

d1212 1
a1212 2
`Y`

is not a variable and `VY`

is not a
number—

`type_error(number, VY).`

d1214 1
a1214 1
`X`

is equal to zero and `Y`

is equal to
d1239 1
a1239 1
value `VX`

and has value of the tangent
a1254 3
`X`

is not a variable and `VX`

is not a
number—

`type_error(number, VX).`

d1269 1
a1269 1
`pi`

has value of π whose value is the ratio of a
d1316 1
a1316 2
`B1`

is a
variable—

`instantiation_error.`

d1318 1
a1318 2
`B2`

is a
variable—

`instantiation_error.`

a1330 3
xor(77, N)
instantiation_error.
@
1.2
log
@*** empty log message ***
@
text
@d11 1
a11 1
PRE-DRAFT TECHNICAL CORRIGENDUM 1
d15 1
d17 1
a17 1
Draft technical corrigendum 1 to International Standard 13211-1:1995
@
1.1
log
@Initial revision
@
text
@d40 1
a40 1
atan2/2, (^)/2, and (div)/2.
d1034 1
a1034 1
@@@@@@
d1037 33
a1069 1
@@@@@@
d1164 4
a1167 4
`atan2(Y, X)`

evaluates the expression `Y`

with
value `VY`

, the expression `X`

with
value `VX`

, and computes the principal value of the arc
tangent of `VY/VX`

(in radians), using the signs of both
d1335 3
@