head 1.108; access; symbols; locks ulrich:1.108; strict; comment @# @; 1.108 date 2011.06.22.12.26.41; author ulrich; state Exp; branches; next 1.107; 1.107 date 2011.06.22.12.25.43; author ulrich; state Exp; branches; next 1.106; 1.106 date 2011.05.24.21.48.00; author ulrich; state Exp; branches; next 1.105; 1.105 date 2011.05.15.21.36.49; author ulrich; state Exp; branches; next 1.104; 1.104 date 2011.05.14.18.32.38; author ulrich; state Exp; branches; next 1.103; 1.103 date 2011.05.14.18.24.31; author ulrich; state Exp; branches; next 1.102; 1.102 date 2011.05.14.10.14.14; author ulrich; state Exp; branches; next 1.101; 1.101 date 2011.04.28.07.25.04; author ulrich; state Exp; branches; next 1.100; 1.100 date 2011.04.28.07.12.47; author ulrich; state Exp; branches; next 1.99; 1.99 date 2011.04.27.21.21.23; author ulrich; state Exp; branches; next 1.98; 1.98 date 2011.04.26.23.31.28; author ulrich; state Exp; branches; next 1.97; 1.97 date 2011.04.12.19.02.12; author ulrich; state Exp; branches; next 1.96; 1.96 date 2011.03.22.15.02.39; author ulrich; state Exp; branches; next 1.95; 1.95 date 2010.12.08.23.20.34; author ulrich; state Exp; branches; next 1.94; 1.94 date 2010.12.07.17.07.02; author ulrich; state Exp; branches; next 1.93; 1.93 date 2010.12.06.23.25.58; author ulrich; state Exp; branches; next 1.92; 1.92 date 2010.12.06.22.42.39; author ulrich; state Exp; branches; next 1.91; 1.91 date 2010.11.30.22.23.58; author ulrich; state Exp; branches; next 1.90; 1.90 date 2010.11.30.22.23.21; author ulrich; state Exp; branches; next 1.89; 1.89 date 2010.11.30.22.22.56; author ulrich; state Exp; branches; next 1.88; 1.88 date 2010.11.30.22.22.15; author ulrich; state Exp; branches; next 1.87; 1.87 date 2010.11.30.22.21.26; author ulrich; state Exp; branches; next 1.86; 1.86 date 2010.11.30.22.17.08; author ulrich; state Exp; branches; next 1.85; 1.85 date 2010.11.29.17.57.23; author ulrich; state Exp; branches; next 1.84; 1.84 date 2010.11.26.17.55.17; author ulrich; state Exp; branches; next 1.83; 1.83 date 2010.11.26.15.50.29; author ulrich; state Exp; branches; next 1.82; 1.82 date 2010.11.26.15.46.04; author ulrich; state Exp; branches; next 1.81; 1.81 date 2010.11.26.15.38.11; author ulrich; state Exp; branches; next 1.80; 1.80 date 2010.11.26.15.31.02; author ulrich; state Exp; branches; next 1.79; 1.79 date 2010.11.10.04.29.43; author ulrich; state Exp; branches; next 1.78; 1.78 date 2010.11.10.03.25.13; author ulrich; state Exp; branches; next 1.77; 1.77 date 2010.11.10.02.40.17; author ulrich; state Exp; branches; next 1.76; 1.76 date 2010.11.10.01.07.10; author ulrich; state Exp; branches; next 1.75; 1.75 date 2010.10.14.18.33.23; author ulrich; state Exp; branches; next 1.74; 1.74 date 2010.10.14.17.39.19; author ulrich; state Exp; branches; next 1.73; 1.73 date 2010.10.14.17.34.43; author ulrich; state Exp; branches; next 1.72; 1.72 date 2010.10.11.22.18.58; author ulrich; state Exp; branches; next 1.71; 1.71 date 2010.10.07.13.12.37; author ulrich; state Exp; branches; next 1.70; 1.70 date 2010.10.06.20.30.18; author ulrich; state Exp; branches; next 1.69; 1.69 date 2010.10.06.07.40.10; author ulrich; state Exp; branches; next 1.68; 1.68 date 2010.10.05.00.26.00; author ulrich; state Exp; branches; next 1.67; 1.67 date 2010.10.05.00.22.49; author ulrich; state Exp; branches; next 1.66; 1.66 date 2010.10.05.00.10.51; author ulrich; state Exp; branches; next 1.65; 1.65 date 2010.09.30.17.10.27; author ulrich; state Exp; branches; next 1.64; 1.64 date 2010.09.30.12.34.20; author ulrich; state Exp; branches; next 1.63; 1.63 date 2010.09.30.09.29.17; author ulrich; state Exp; branches; next 1.62; 1.62 date 2010.09.30.09.27.47; author ulrich; state Exp; branches; next 1.61; 1.61 date 2010.09.28.17.56.05; author ulrich; state Exp; branches; next 1.60; 1.60 date 2010.09.27.18.11.38; author ulrich; state Exp; branches; next 1.59; 1.59 date 2010.09.24.19.28.25; author ulrich; state Exp; branches; next 1.58; 1.58 date 2010.09.24.19.03.13; author ulrich; state Exp; branches; next 1.57; 1.57 date 2010.09.24.10.19.18; author ulrich; state Exp; branches; next 1.56; 1.56 date 2010.09.23.22.10.27; author ulrich; state Exp; branches; next 1.55; 1.55 date 2010.09.23.22.07.35; author ulrich; state Exp; branches; next 1.54; 1.54 date 2010.09.23.21.40.47; author ulrich; state Exp; branches; next 1.53; 1.53 date 2010.09.23.12.37.20; author ulrich; state Exp; branches; next 1.52; 1.52 date 2010.09.21.22.54.43; author ulrich; state Exp; branches; next 1.51; 1.51 date 2010.09.21.22.54.30; author ulrich; state Exp; branches; next 1.50; 1.50 date 2010.09.21.20.49.22; author ulrich; state Exp; branches; next 1.49; 1.49 date 2010.09.20.08.59.19; author ulrich; state Exp; branches; next 1.48; 1.48 date 2010.09.18.14.50.21; author ulrich; state Exp; branches; next 1.47; 1.47 date 2010.09.18.14.27.23; author ulrich; state Exp; branches; next 1.46; 1.46 date 2010.09.18.14.19.42; author ulrich; state Exp; branches; next 1.45; 1.45 date 2010.09.18.13.00.51; author ulrich; state Exp; branches; next 1.44; 1.44 date 2010.09.18.12.41.24; author ulrich; state Exp; branches; next 1.43; 1.43 date 2010.09.17.18.19.58; author ulrich; state Exp; branches; next 1.42; 1.42 date 2010.09.17.16.58.06; author ulrich; state Exp; branches; next 1.41; 1.41 date 2010.09.17.14.10.27; author ulrich; state Exp; branches; next 1.40; 1.40 date 2010.09.17.00.06.10; author ulrich; state Exp; branches; next 1.39; 1.39 date 2010.09.17.00.05.18; author ulrich; state Exp; branches; next 1.38; 1.38 date 2010.09.17.00.05.06; author ulrich; state Exp; branches; next 1.37; 1.37 date 2010.09.16.23.54.16; author ulrich; state Exp; branches; next 1.36; 1.36 date 2010.09.16.22.04.44; author ulrich; state Exp; branches; next 1.35; 1.35 date 2010.09.16.16.22.07; author ulrich; state Exp; branches; next 1.34; 1.34 date 2010.09.16.12.25.50; author ulrich; state Exp; branches; next 1.33; 1.33 date 2010.09.15.20.20.55; author ulrich; state Exp; branches; next 1.32; 1.32 date 2010.09.15.20.19.07; author ulrich; state Exp; branches; next 1.31; 1.31 date 2010.09.15.20.18.41; author ulrich; state Exp; branches; next 1.30; 1.30 date 2010.09.15.18.09.34; author ulrich; state Exp; branches; next 1.29; 1.29 date 2010.09.15.18.05.57; author ulrich; state Exp; branches; next 1.28; 1.28 date 2010.09.15.16.45.51; author ulrich; state Exp; branches; next 1.27; 1.27 date 2010.09.15.13.15.56; author ulrich; state Exp; branches; next 1.26; 1.26 date 2010.09.15.13.13.46; author ulrich; state Exp; branches; next 1.25; 1.25 date 2010.09.14.14.22.33; author ulrich; state Exp; branches; next 1.24; 1.24 date 2010.09.14.10.59.49; author ulrich; state Exp; branches; next 1.23; 1.23 date 2010.09.14.00.59.59; author ulrich; state Exp; branches; next 1.22; 1.22 date 2010.09.14.00.17.46; author ulrich; state Exp; branches; next 1.21; 1.21 date 2010.09.14.00.16.46; author ulrich; state Exp; branches; next 1.20; 1.20 date 2010.09.13.22.52.59; author ulrich; state Exp; branches; next 1.19; 1.19 date 2010.09.13.13.32.50; author ulrich; state Exp; branches; next 1.18; 1.18 date 2010.09.13.13.27.56; author ulrich; state Exp; branches; next 1.17; 1.17 date 2010.09.12.22.10.28; author ulrich; state Exp; branches; next 1.16; 1.16 date 2010.09.12.12.09.38; author ulrich; state Exp; branches; next 1.15; 1.15 date 2010.09.11.22.40.32; author ulrich; state Exp; branches; next 1.14; 1.14 date 2010.09.11.18.14.13; author ulrich; state Exp; branches; next 1.13; 1.13 date 2010.09.11.17.31.35; author ulrich; state Exp; branches; next 1.12; 1.12 date 2010.09.11.15.33.35; author ulrich; state Exp; branches; next 1.11; 1.11 date 2010.09.10.19.31.21; author ulrich; state Exp; branches; next 1.10; 1.10 date 2010.09.10.19.19.06; author ulrich; state Exp; branches; next 1.9; 1.9 date 2010.09.10.18.09.44; author ulrich; state Exp; branches; next 1.8; 1.8 date 2010.09.10.13.36.45; author ulrich; state Exp; branches; next 1.7; 1.7 date 2010.09.10.12.39.30; author ulrich; state Exp; branches; next 1.6; 1.6 date 2010.09.10.11.46.17; author ulrich; state Exp; branches; next 1.5; 1.5 date 2010.09.09.20.56.08; author ulrich; state Exp; branches; next 1.4; 1.4 date 2010.09.09.13.04.48; author ulrich; state Exp; branches; next 1.3; 1.3 date 2010.09.07.23.23.11; author ulrich; state Exp; branches; next 1.2; 1.2 date 2010.09.07.23.14.14; author ulrich; state Exp; branches; next 1.1; 1.1 date 2010.09.07.22.06.02; author ulrich; state Exp; branches; next ; desc @@ 1.108 log @*** empty log message *** @ text @ Draft technical corrigendum 2

Information technology - Programming languages - Prolog - Part 1:
General Core
DRAFT TECHNICAL CORRIGENDUM 2

((This is the HTML-source))

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.
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]
Additional corrections: Unresolved corrections:
C1 Add new error class and change one error condition of open/3,4 (Resolution A1, Edinburgh 2010)

7.12.2 Error classification

Remove in subclause b variable from the enumerated set ValidType.
Add additional error class:
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.

8.1.3 Errors (The format of built-in predicate definitions)

Replace in Note 5
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 error when the argument is not a variable.
the words
a type error
by
an uninstantiation error

8.11.5.3 Errors (open/4, open/3)

Replace error condition f
f) Stream is not a variable
type_error(variable, Stream).
by
f) Stream is not a variable
uninstantiation_error(Stream).

C2 Allow bar character | as infix operator, forbid '{}' and '[]' as operators (Resolution A7 and A8, Edinburgh 2010)

6.3.4.3 Operators

Add prior to syntax rules:
A bar (6.4) shall be equivalent to the atom '|' when '|' is an operator.
Add the syntax rule:
op =bar ;
Abstract: |
Priority: nn
Specifier:ss
Condition:'|' is an operator
Add at the end of 6.3.4.3 before NOTES:
There shall not be an operator '{}' or '[]'.

An operator '|' shall be only an infix operator with priority greater than or equal to 1001.
Add to note 1
Bar is also a solo character (6.5.3), and a token (6.4) but not an atom.
Replace note 3
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.
by
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.

6.4 Tokens

Add as the last syntax rule:
bar (* 6.4 *)
   = [ layout text sequence (* 6.4.1 *) ] ,
     bar token (* 6.4.8 *) ;

6.4.8 Other tokens

Add as the last syntax rule:
bar token (* 6.4.8 *)
  = bar char (* 6.5.3 *) ;

6.5.3 Solo characters

Add alternative for solo char:
  | bar char (* 6.5.3 *)
Add as the last syntax rule:
bar char (* 6.5.3 *) = "|" ;

8.14.3.3 Errors (op/3)

Replace
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).
by
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).
Add additional error:
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).

8.14.3.4

Add the following examples:
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 Add testing built-in predicate subsumes_term/2 (Part of resolution A2, Edinburgh 2010)

Add the new subclauses into the place indicated by their number:

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 Add testing built-in predicates callable/1, ground/1, acyclic_term/1 (Part of resolution A2, Edinburgh 2010)

Add the new subclauses into the place indicated by their number:

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 Add built-in predicates compare/3, sort/2, keysort/2 based on term order (Part of resolution A2, Edinburgh 2010)

7.12.2 b

Add pair to the set ValidType.

7.12.2 c

Add order to the set ValidDomain.

8.4, 8.4.1

Move the two paragraphs from subclause 8.4 to subclause 8.4.1. Add into subclause 8.4:
These built-in predicates compare and sort terms based on the ordering of terms (7.2).


Add the new subclauses into the place indicated by their number:

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 Add built-in predicate term_variables/2 (Part of resolution A2, Edinburgh 2010)

Add the new subclauses into the place indicated by their number:

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 Correct error condition for retract/1

8.9.3.3 Errors (retract/1)

Replace in error condition c

permission_error(access, static_procedure, Pred).
by

permission_error(modify, static_procedure, Pred).

C8 Add built-in predicate retractall/1 (Part of resolution A2, Edinburgh 2010)

Add the new subclauses into the place indicated by their number:

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 Add built-in predicate call/2..8 and false/0 (Part of resolution A2, Edinburgh 2010)

Add the new subclauses into the place indicated by their number:

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(X1,...,XM), Y2, ..., YN) be the goal to be executed, M ≥ 0,
b) Execute call(p(X1, ..., XM, Y2, ..., YN)) instead.

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 Correct error conditions of atom_chars/2, atom_codes/2, number_chars/2, number_codes/2

Add the new sublauses into the place indicated by their number:

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].

8.16.4.3 Errors (atom_chars/2)

Replace error condition a, c, and d. Add error condition 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 a one-char atom
type_error(character, E).

8.16.5.3 Errors (atom_codes/2)

Replace error condition a, c, and d. Add error conditon e and f.
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).

8.16.7.3 Errors (number_chars/2)

Replace error condition a, c, and d. Add error conditon f.
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).

8.16.8.3 Errors (number_codes/2)

Replace error conditions a, c, and d. Add error condition f and g.
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 Correct error conditions for evaluating an expression.

7.9.2

Replace error condition i and j (which both were added in Technical Corrigendum 1)
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).
by
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 the i-th argument of E has a different type

type_error(Type, Culprit).

C12 Correct example for call/1

7.8.3.4 example no. 6

For program
b(X) :-
   Y = (write(X), X),
   call(Y).
replace
b(3).
   Outputs '3', then
   type_error(callable, 3).
by
b(3).
   type_error(callable, (write(3),3)).

C13 Adjust Template and Modes of catch/3, remove error conditions. In this manner all errors of the goal are caught by catch/3

7.8.9

Replace

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)
by

7.8.9.2 Template and modes

catch(goal, ?term, goal)

7.8.9.3 Errors

None.

C14 Add 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)

6.3.4.4



Add in Table 7 - The operator table:
Priority Specifier Operator(s)
400 yfx div
200 fy +

9.1.1

Add to table:
Evaluable functor Operation
(div)/2 intfloordivI
(+)/1 posI, posF
Add 'div' to enumeration in Note. Add to Note:
'+', '-' are prefix predefined operators.

9.1.3

Add specifications:
intfloordivI : I × II ∪ {int_overflow, zero_divisor}
posI : I → I
Add as axioms:
intfloordivI(x,y) =x/y
if y ≠ 0 ∧ ⌊x/y⌋ ∈ I
=int_overflow
if y ≠ 0 ∧ ⌊x/y⌋ ∉ I
=zero_divisor
if y = 0
posI (x) = x

9.1.4

Add specification:
posF : F → F
Add as axiom:
posF (x) = x

C15 Add evaluable functors max/2, min/2, (^)/2, asin/1, acos/1, atan2/2, tan/1 (Part of resolution A6, Edinburgh 2010)

Add the new subclauses into the place indicated by their number:

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 value R satisfies R ∈ {VX, VY}.

If VX and VY have different types then let VI and VF be the values of type integer and float. The value R shall satisfy
R ∈ {VI, float(VI), VF, undefined}
and the value shall be implementation dependent.
NOTE — The possible values of float(VI) include the exceptional value float_overflowF (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 with
floatI→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 value R satisfies R ∈ {VX, VY}.

If VX and VY have different types then let VI and VF be the values of type integer and float. The value R shall satisfy
R ∈ {VI, float(VI), VF, undefined}
and the value shall be implementation dependent.
NOTE — The possible values of float(VI) include the exceptional value float_overflowF (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 with
floatI→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 value R satisfies
-π/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 value R satisfies
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 value R, that is, the value R satisfies
-π ≤ 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 Add evaluable atom pi/0 (Part of resolution A6, Edinburgh 2010)

7.9.1 Description (Evaluating an expression)

Replace 7.9.1 Note 1
1 An error occurs if T is an atom or variable.
by
1 An error occurs if T is a variable or if there is no operation F in step 7.9.1 c).


Add the new subclauses into the place indicated by their number:

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 Add evaluable functor xor/2 (Part of resolution A6, Edinburgh 2010)

Add the new subclauses into the place indicated by their number:

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.

Annex A
(informative)
Issues still to be resolved


C18 Correct example for write_canonical/1

An example for 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.

8.14.2.4 Examples

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

Annex B
(informative)
Editorial notes

Check that there are no @@@@@@.

Unusual characters

Check the following characters are correctly printed.
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: ≤

Background

These faults were noted after preparing for publication the text of ISO/IEC 13211-1:1995 Prolog: Part 1 - General Core, subsequent lists of errors noted by WG17 and after preparing for publication the text of Technical Corrigendum 1.

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

Document history

Version control
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

8.15.4.1 Description

@ 1.105 log @Forgotten old condition a in atom_codes/2 @ text @d176 1 a176 1 set. d953 1 a953 1 defining 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
a) 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
e) An element of a list prefix of List is neither a variable nor a one-char atom d1424 1 a1424 1 Replace error condition a, c, and d. Add error conditon e. d1444 1 a1444 1
e) An element 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 Replace error condition a, c, and d by: d1364 2 a1365 3
a) 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
d) An element of a list prefix of List is neither a d1389 1 a1389 1 Replace error condition a, c, and d. Add error conditon f. d1404 6 a1409 1
d) An element E of a list prefix of List d1424 1 a1424 1 Replace error condition a, c, and d by: d1430 2 a1431 3
a) 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
d) An element E of a list prefix of List d1455 1 a1455 1 Replace error conditions a, c, and d. Add error condition f. d1461 2 a1462 3
a) 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
d) An element E of a list prefix of List d1480 1 a1480 1
f) An element of a list prefix of List is neither a @ 1.101 log @Introduced Else if @ text @d1364 1 a1364 1
a) Atom is a variable and List is a d1390 1 a1390 1
a) Atom is a variable and List is a d1421 1 a1421 1
a) Number is a variable and List is a d1448 1 a1448 1
a) Number is a variable and List is a @ 1.100 log @m @ text @d652 1 a652 1
b) If X term_precedes Y (7.3), then d656 1 a656 1
c) Let R be the atom '>'. @ 1.99 log @Make procedural definition of compare/3 clearer. Roger Scowen @ text @d656 1 a656 1
c)Let R be the atom '>'. @ 1.98 log @Simple changes. Roger Scowen @ text @d648 3 a650 6
a) Let R be the atom '=', '<', or '>' if X and Y are identical, X term_precedes Y (7.3), or Y term_precedes X respectively. d652 7 a658 1
b) If R unifies with Order, then the d661 1 a661 1
c) Else the goal fails. @ 1.97 log @JISC comments integrated @ text @d639 1 a639 1 '<' iff X term_precedes 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
  • Error condition for retract/1 d508 1 a508 1 Add the new subclauses into the place indicated by their number @ 1.95 log @The very last changes @ text @d1305 1 a1305 1

    8.15.5.3 Examples

    d1911 1 a1911 1 large d2135 1 a2135 1

    7.9.1 Description (Evaluation an expression)

    @ 1.94 log @Date adaptation @ text @d824 1 a824 1
    c)If KVs unifies with Sorted, then the d967 1 a967 1
    a) Let 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

  • Error condition for retract/1 [C7] d175 2 a176 2

    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

    9.3.1.1 Description

    d1951 1 a1951 1

    9.3.1.2 Template and modes

    d2034 2 d2129 1 a2129 1 Replace 7.9.1 Note 1 d2137 1 a2137 1 by d2147 1 a2147 1 Add the new subclauses into the place indicated by their number: d2182 2 d2258 1 a2258 2 An example for 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
    Dash, ndash: —, –
    Rightwards arrow: →
    Union: ∪
    Floor: ⌊ ⌋
    Inequality: ≠
    Logical and: ∧
    Element of, not in: ∈, ∉
    Times: ×
    Pi, theta: π, θ @ 1.84 log @*** empty log message *** @ text @d953 2 a954 2 the terms 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

    Pi, Theta: π, θ a2230 3 Find better dash d2253 2 @ 1.77 log @*** empty log message *** @ text @d861 2 a862 2
    f) An element 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
    Add new error class and change one error condition of open/3,4 (Resolution A1, Edinburgh 2010) d216 2 a217 2
    Allow bar character | as infix operator, forbid '{}' and '[]' as operators (Resolution A7 and A8, Edinburgh 2010) d384 2 a385 3
    Add testing built-in predicates subsumes_term/2, callable/1, ground/1, acyclic_term/1 (Part of resolution A2, Edinburgh 2010) d469 11 d574 1 a574 1
    Add built-in predicates compare/3, sort/2, keysort/2 based on a671 5 Add the new subclauses into the place indicated by their number:
    d900 2 a901 3
    Add built-in predicate term_variables/2 and retractall/1 (Part of resolution A2, Edinburgh 2010), related minor correction for retract/1 d1001 3 a1003 1

    8.9.3.3 Errors (retract/1)

    d1021 4 d1118 11 d1279 1 a1279 1
    Correct error conditions of atom_chars/2, atom_codes/2, d1432 1 a1432 1
    Correct error conditions for evaluating an expression. d1476 1 a1476 1
    Correct example for call/1 d1507 1 a1507 1
    Adjust Template and Modes of catch/3, remove error xconditions. d1557 4 a1560 4
    Add 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 1
    Add evaluable functors max/2, min/2, (^)/2, asin/1, acos/1, d2085 2 a2086 1
    Add evaluable atom pi/0 (Part of resolution A6, Edinburgh d2103 1 a2103 1
    1 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 1
    d) Pairs is a list with an element which is a variable d848 3 a850 3
    e) 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 2
    f) An element of a list prefix of List is neither a variable nor a character code d1367 2 a1368 2
    d) An element E of a list prefix of List is neither a variable nor a one-char atom d1394 2 a1395 2
    d) An element E of a list prefix of List is neither a variable nor an integer d1399 2 a1400 2
    f) 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 1
  • Template and modes, and error conditions of catch/3. @ 1.72 log @Renumbering - Ulrich Geske @ text @d135 2 d1483 48 a2072 41

    7.8.9

    Replace

    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)
    by

    7.8.9.2 Template and modes

    catch(goal, ?term, goal)

    7.8.9.3 Errors

    None.
    @ 1.71 log @*** empty log message *** @ text @d1711 1 a1711 1
    e) VX or VY is a float and the magnitude d1717 1 a1717 1
    f) VX or VY is a float and the magnitude @ 1.70 log @*** empty log message *** @ text @d2078 1 a2078 1
    Rightwards 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 1
    e) 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 1
    e) 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 2
    d) 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 2
    d) An element E of the partial list or list List is neither a variable nor an integer d1339 2 a1340 2
    e) 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 2
    d) An element E of the partial list or list List is neither a variable nor a one-char atom d1392 2 a1393 2
    d) An element E of the partial list or list List is neither a variable nor an integer d1397 2 a1398 2
    e) 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
  • d1279 6 a1284 4
    NOTE — For example [], [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

    7.1.1.5 Witness variable list of a term

    d1257 15 d1274 1 a1274 1 Replace error condition c and d by: d1279 6 d1300 1 a1300 1 Replace error condition c and d by: d1305 6 d1330 1 a1330 1 Replace error condition c and d by: d1336 6 d1357 1 a1357 2 Rename error condition e to f. Replace error conditions c and d by: d1363 6 d2004 1 a2004 1

    7.8.9

    @ 1.64 log @Added Annex A @ text @d1984 1 a1984 1
    b) G is neihter a variable nor a callable term @ 1.63 log @*** empty log message *** @ text @d1963 47 a2009 1
    Annex B
    (informative)
    Editorial notes
    @ 1.62 log @Mike Elston @ text @d1098 1 a1098 1 type_error(callable, 3) @ 1.61 log @*** empty log message *** @ text @d554 1 a554 1 [STO, does not succeed in many implementations, d747 1 a747 1 [STO, corresponds to the goal [V] = V. In many d875 1 a875 1 [STO. type_error(list, [1-2,1-2,...]) or loops d880 1 a880 1 [STO, corresponds to the goal [V-V] = V. In d988 1 a988 1 [STO, corresponds to the goal [X, Vars] = Vars.] a1083 1 insect(spider). d1091 1 a1091 1 retractall(insect(elephant)). d1582 1 a1582 1 max(2, 3) d1585 1 a1585 1 max(2.0, 3) d1589 1 a1589 1 max(2, 3.0) d1617 1 a1617 1 ^(int-exp, int-exp) = int @ 1.60 log @*** empty log message *** @ text @d1377 12 a1388 5 operator in step 7.9.1 c and the value Culprit of the i-th argument of E has a type for which there is no corresponding operator with that type in the i-th argument but there is a corresponding operator with type Type in the i-th argument a1391 1 a1536 7

    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

    NOTE — The possible values of float(VX) and float(VY) include the exceptional @ 1.58 log @Mats Carlsson @ text @d133 1 a133 1
  • Type errors for call/1 d1389 1 a1389 19
    Correct examples for call/1 to permit precise culprits in type errors.

    7.8.3.3 Errors

    Add new error condition
    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).
    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:
    call((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.]
    
    @ 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 satisfies
    -π/2 ≤ R ≤ π/2. @ 1.55 log @*** empty log message *** @ text @d1392 1 a1392 1

    7.9.3.3 Errors

    @ 1.54 log @After (first) discussion "Culprits in type errors - call/1" @ text @d133 1 a133 1
  • Example for call/1. @ 1.53 log @Jan Burse @ text @d1389 19 a1407 1
    Correct example for call/1. d1433 1 a1433 1 type_error(callable, (write(3),3)). or d1435 22 d1461 1 @ 1.52 log @*** empty log message *** @ text @d83 4 d474 6 d499 3 d750 5 d1415 2 a1416 1 type_error(callable, (write(3),3)). @ 1.51 log @*** empty log message *** @ text @d1021 1 a1021 1
    2 Many existing processors define 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
    2 Many implementations of 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
    2 The concept of a variable list of a term is required when @ 1.47 log @Typo, Joachim Schimpf @ text @d1194 1 a1194 1 maplist(<(3), [1, 2]). d1197 1 a1197 1 maplist(<(3), [1, 2, 3]). @ 1.46 log @Typo Mats Carlsson @ text @d1463 1 a1463 1 if i = 0 @ 1.45 log @retractall/1 removed ambiguous cases @ text @d855 1 a855 1 Pairs = [1-2|List], keysort(Pairs, Sorted). @ 1.44 log @*** empty log message *** @ text @d1021 2 d1024 7 a1030 2
    2 If no corresponding procedure was found, the database remains unaltered. @@@@@@ or not a1084 27 retractall(nonexistent), nonexistent. @@@@@@ unclear which one existence_error(procedure, nonexistent/0) @@@@@@ GNU, B, N208, IF (via retract/1). Fails. @@@@@@ YAP, SICStus, SWI, CIAO, XSB Other error @@@@@@ ECLiPSe retractall((a :- b)). @@@@@@ unclear which one Succeeds. @@@@@@ GNU, YAP, SWI, B, CIAO, XSB permission_error(modify, static_procedure, (:-)/2) @@@@@@ SICStus, IF (via retract/1) Other error @@@@@@ ECLiPSe

    8.9.5.5 Bootstrapped built-in predicates

    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
    
    The following definition defines the logical and procedural d778 1 a778 1
    The following definition defines the logical and procedural @ 1.39 log @*** empty log message *** @ text @d779 1 a779 1 behaviour of 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

    catch(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).

    @ 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 use 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.

    8.14.3.4

    d676 13 d719 3 a739 12

    8.4.3.5 Bootstrapped built-in predicates

    The following definition 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 */
    
    d776 28 d846 3 a870 26

    8.4.4.5 Bootstrapped built-in predicates

    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.
    d976 1 a976 1

    8.9.3.3

    d1391 31 d1648 1 a1648 1
    @ 1.34 log @*** empty log message *** @ text @d300 2 a303 1
    permission_error(create, operator, Operator). a312 1
    d316 1 d341 3 a343 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

    8.4.2 compare/3

    d722 2 a723 2 The following definition of 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
    a) Let 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
    a) List is a partial list d780 1 a780 1
    b) List is neither a partial list nor a list d782 1 a782 1
    type_error(list, List). d788 1 a788 1
    d) 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

    7.1.1.5 Variable list of a term

    d868 1 a868 1 The variable list of a term T is a list of variables d876 1 a876 1
    1 For example, [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
    c) 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
    a) Creates the sorted list KNVs (7.1.6.5) containing d732 3 a734 3
    b) Creates the list KVs with elements Key-Value occurring in the same sequences as elements t(Key, N, Value in KNVs. d736 2 a737 2
    c)If KVs unifies with Sorted, then the goal succeeds. d768 9 a776 2
    e) An element 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 undefined}
    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
    Add new error class and change one error condition of open/3,4 a138 1 d173 1 a173 1 Replace in subclause f d192 3 a194 3
    Allow bar character | as infix operator, forbid '{}' and '[]' as operators (Resolution A7 and A8, Edinburgh 2010) d220 1 a220 1 There shall not be an operator '{}' or '[]'. d223 1 a223 1 An operator '|' shall be only an infix operator with priority greater than d238 1 a238 1 3 The third argument of op/3 (8.14.3) may be any atom d246 4 a249 4 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. d324 1 a324 1 Add the following examples d350 5 a354 1
    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
    Add built-in predicates compare/3, sort/2, keysort/2 based on term order. d523 1 a523 1 Add 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
    a) KV is an element of KVs iff KV is an element of List
    b) 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
    d) call/N is called with N ≥ 9. It shall be implementation dependent whether or not this error condition is satisfied. d1168 3 a1170 6
    Correct error conditions of atom_chars/2, atom_codes/2, number_chars/2, number_codes/2 d1264 39 d1305 5 a1309 6
    Add 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) (Resolution A6, Edinburgh 2010) d1386 3 d1390 1 a1390 2
    d1407 7 a1413 5 If VX and VY have different types then the value R shall satisfy R ∈ {VX, VY, float(VX), float(VY), undefined} and the value shall be implementation dependent. d1416 4 a1419 1 @@@@@@ One further case being defined is... d1424 1 a1424 1 value float_overflow (9.1.6). d1455 4 a1458 4 of them is an integer VI and floatI→F(VI) = float_overflow (9.1.6). It shall be implementation dependent whether this error condition is satified d1495 1 a1495 1 zero, the value is 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
    @@@@@@ Correct error cases of atom_chars/2, atom_codes/2, number_chars/2, number_codes/2 d1308 12 a1319 2 shall be implementation dependent whether or not this error condition is then satisfied @@@@@@ @ 1.23 log @number_chars/2 & co reformulation, including partial lists for elements. @ text @d403 4 a406 7
    2 Many existing processors implement a built-in predicate 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
    2) Implement 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 float_overflow. d1289 4 @ 1.22 log @one inconsistent name from N208 @ text @d131 1 a131 1
    d146 1 a146 1
    d152 1 a152 1
    d160 1 a160 1
    d168 1 a168 1
    d185 1 a185 1
    d191 1 a191 1
    d203 1 a203 1
    d215 1 a215 1
    d222 1 a222 1
    d230 1 a230 1
    d241 1 a241 1
    d253 1 a253 1
    d263 1 a263 1
    d271 1 a271 1
    d280 1 a280 1
    d287 1 a287 1
    d295 1 a295 1
    d311 1 a311 1
    d338 1 a338 1
    d516 1 a516 1
    d524 1 a524 1
    d575 2 a576 2 compare(==, 3, 3.0). domain_error(order, ==). d582 1 a582 1
    d705 1 a705 1
    d932 3 a934 2
    d) call/9 is called. It is implementation dependent whether or not this error is produced. d1040 1 a1040 1
    d1047 2 a1048 2
    d) An element E of the list List is neither a variable nor a one-char atom d1060 1 a1060 1
    d1067 2 a1068 2
    d) An element E of the list List is neither a variable nor an integer code d1072 2 a1073 7
    e) 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 1
    d1088 1 a1088 2
    d) 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 1
    d1153 1 a1153 1
    d1163 1 a1163 1
    d1171 1 a1171 1
    d1175 2 a1176 1
    d1182 1 a1182 1
    d1193 1 a1193 1
    d1202 1 a1202 1
    d1208 1 a1208 1
    d1217 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 4
    Generalθ and Specificθ are identical, and
    Specificθ and Specific d354 1 a354 1
    d389 1 a389 2
    NOTES d391 3 a393 1
    1 The final two examples show that subsumes_term/2 is d395 1 a395 1 term-lattice partial order is: d397 1 a397 1
    d403 1
    a403 1
    
    2 d410 2 a411 1
    d416 1
    a416 1
    
    d539 1 a539 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 5

    NOTES

    1 For example, [X, Y] is the variable list of each of the terms f(X,Y), X+Y+X, d721 4 a724 4

    2 The concept of a variable list of a term is required when defining term_variables/2

    d736 3 a738 1
    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 1

    NOTES 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 2
    NOTE — A built-in predicate apply/2 was implemented d891 1 a891 1
    d919 3 a921 2
    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 2
    NOTE — A standard-conforming processor may implement call/N in one d943 1 a943 1 d957 1 a958 1
    d1042 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 2

    NOTE — 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) Y is a variable
    instantiation_error. d1324 1 a1324 1
    d1344 1 a1344 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 1 Allow 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 1
    Dash: — @ 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 call/N is executed as follows: d795 1 a795 1 YN) 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 callable(Term) is true iff Term is a callable term. a683 2 @@@@@@ d686 4 a689 12

    a) Determines the principal functor P and arity N associated with Head. P/N is the associated predicate indicator
    b) If the database contains a dynamic procedure whose predicate indicator is P/N, then proceeds to 8.9.5.1 d,
    c) Else the goal succeeds.
    d) Retracts from the database all clauses whose head unifies with 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).

    7.12.2 b

    Add pair to the set ValidType. Add the new subclauses into the place indicated by their number:

    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(_)].
    
    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
    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)
    d908 1 a908 1

    6.3.4.4

    d995 17 a1011 6 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
    a) X is a variable or Y is a variable
    instantiation_error. d1028 1 a1028 5
    b) X is not a variable and VX is not a number
    type_error(number, VX).
    c) 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
    b) X is not a variable and VX is not a number
    type_error(number, VX).
    c) VX is greater than 1 or less than a1160 1 d1167 1 a1167 4
    b) X is not a variable and VX is not a number
    type_error(number, VX).
    c) 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
    a) X is a variable or Y is a variable
    instantiation_error.
    b) X is not a variable and VX is not a number
    type_error(number, VX). d1212 1 a1212 2
    c) Y is not a variable and VY is not a number
    type_error(number, VY). d1214 1 a1214 1
    d) X is equal to zero and Y is equal to d1239 1 a1239 1 value VX and has value of the tangent a1254 3
    b) 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
    a) B1 is a variable
    instantiation_error. d1318 1 a1318 2
    b) 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 @