General Core

WORKING DRAFT TECHNICAL CORRIGENDUM 3

This document is prepared in fulfillment of WG 17 resolutions in Istanbul 2013/Vienna 2014.

C1

## 5.5.12 Options.

A processor may support one or more additional options, like stream options (7.10.2.11), stream close options (7.10.2.12), stream properties (7.10.2.13), read options (7.10.3), and write options (7.10.4) as an implementation specific feature.@@@ The processing of options is associated only with instantiation errors and domain errors for the specific option domain. (Refer to 8.1.2 Notes)

a) If Tbyunifies with^(_, G) then ...

a) If Thas the form^(_, G) then ...

`variable_names(VN_list)`

— After inputting a

term,`VN_list`

shall be unified with a list of ele-

ments where: (1) each element is a term`A = V`

, and

(2)`V`

is a named variable of the term, and (3)`A`

is an

atom whose name is the characters of`V`

,and (4) the elements appear in the order of their variables`V`

in the term input, in left-to-right traversal order.

`singletons(VN_list)`

— After inputting a term,

`VN_list`

shall be unified with a list of elements

where: (1) each element is a term`A = V`

, and (2)`V`

is

a named variable which occurs only once in the term,

and (3)`A`

is an atom whose name is the characters of`V`

.

@@@ idem

`numbervars(Bool)`

`numbervars(Bool)`

- Iff`Bool`

(7.1.4.2) is`true`

a

term of the form`'$VAR'(N)`

, where`N`

isana non-negativeinteger, is

output as a variable name consisting of a capital letter

possibly followed by an integer.

`variable_names(VN_list)`

in analogy to
the read-option `variable_names(VN_list)`

.
7.10.4 add:

`variable_names(VN_list)`

— Each variable`V`

is output as the unquoted atom`A`

iff a term`A = V`

is an element of the list`VN_list`

. If more than one element applies, the leftmost is used.

- NOTE 2 — For
write-option
`variable_names(VN_list)`

any instance (3.95) of a term obtained with the corresponding read-option is well defined. @@@ Actually, only the selection of the variable names to be printed is well defined. - NOTE 3 &mdahs; Many processors had @@@abused the write option numbervars/1 for printing arbitrary variable names. @@@

a1) If`Term`

is a variable and there is an effective write-option`variable_names(VN_list)`

and there is an element`A = Term`

of the list`VN_list`

with`A`

an atom, then`A`

is output with effective write-option`quoted(false)`

.

`Term`

has the
form `'$VAR'(N)`

for some itive

e2) Else if`Term`

has the form`'{}'(Arg)`

, and there is an effective write-option`ignore_ops(false)`

, then`Term`

is output as a curly bracketed term (6.3.6), that is:

- 1)
`{`

(open curly char) is output- 2)
`Arg`

is output by recursively applying these rules- 3)
`}`

(close curly char) is output

h)byIf`Term`

has a principal functor ...

h) If Term has a principal functor which is anAdd:

operator, and there is an effective write-option

ignore_ops(false), then the term is output in operator

form, that is:1) The atom of the principal functor is output

in front of its argument (prefix operator), between

its arguments (infix operator), or after its argument

(postfix operator). In all cases, a space is output

to separate an operator from its argument(s) if any

ambiguity could otherwise arise.

Operators`','`

and`'|'`

are output as`,`

(comma char) and`|`

(bar char) respectively.

2) Each argument of the term is output by recursively

applying these rules. When an argument is itself

to be output in operator form, it is preceded by (

(open char) and followed by ) (close char) if: (i) the

principal functor is an operator whose priority is so

high that the term could not be re-input correctly with

same set of current operators, or (ii) the argument is

an atom which is a current operator.

- Condition (ii) never applies, because there is a further contradicting condition in front: "When an argument is itself to be output in operator form". If we have an argument which is an atom then that atom is not be output in operator form. Only certain principal functors of arity one and two are to be output in operator form. Thus, we will never get to condition (ii).
- The cases - (1) and - (1^a) are not mentioned explicitly.
- The cases (1,2) and (1|2) are not mentioned.

2) Each argument of the term is output by recursively applying these rules.An argumentis preceded by ( (open char) and followed by ) (close char) if: (i) the principal functor is an operator whose priority is so high that the term could not be re-input correctly with the same set of current operators, or (ii) the argument is an atom which is a current operator,or (iii) the principal functor is output as a prefix operator`-`

and the argument is a non-negative number, or (iv) the principal functor is output as a prefix operator`-`

and the argument is to be output in infix or postfix operator form.

`float`

to the set `ValidType`

.
`character_code_list`

from
the set `ValidDomain`

.
`PermissionType ∈ { `__binary_stream
flag__,

add comma.
7 When a built-in predicate has an argument whose type is a list of options (@@@ as input?), that argument will be an +xxx_options_list. (There should be a type name_options_list used in Template and Modes, and a corresponding domain_error(name_option)). That argument will always be associated with

- an instantiation error, when the argument is a partial list, or an element is not a valid option but an instance of the element is a valid option.
- a domain error, when an element is neither a valid option nor any instance is a valid option.

`type_error(evaluable,unbound)`

when Prolog flag
bounded is false. @@@
e) Constructs the clause with headReplace by`H`

and body,`B`

`G`

.
`[a, b, f(b), f(a)]`

as in IS 13211-1:1995.
b) the goal succeeds.

Same for 8.11.6.3 b, 8.14.1.3 b, 8.14.2.3 b.

- c)
`Options`

is a partial list or a list with an element

`E`

which is a variableor which has a component

which is a variable, and an instantiated component is required.

—`instantiation_error.`

by

- k) Parses
`C_Seq`

as a read-term(6.4)`T.`

,

- k) Parses
`C_Seq`

as a read-term(6.2.2)`T.`

,

- e) An element
`E`

of the`Options`

list is neither a

variable nor a valid write-option

—`domain_error(write_option, E).`

write_term(1,[quoted(nonbool)]). domain_error(write_option,quoted(nonbool)) write_term(1,[quoted(B)]). domain_error(write_option,quoted(_))The second case seems to be particularly problematic because a further instantiation would make this goal succeed.

B = true, write_term(1,[quoted(B)]). Succeeds, outputting the character 1.See also write options.

*Replace*

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

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

`VX`

is negative and `VY`

.
Here are the values for `X^Y`

for `X, Y in -3..3`

.

`Y` | ||||||||

3 | -27 | -8 | -1 | 0 | 1 | 8 | 27 | |

2 | 9 | 4 | 1 | 0 | 1 | 4 | 9 | |

1 | -3 | -2 | -1 | 0 | 1 | 2 | 3 | |

0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | |

-1 | ty.e | ty.e | -1 | e.u | 1 | ty.e | ty.e | |

-2 | ty.e | ty.e | 1 | e.u | 1 | ty.e | ty.e | |

-3 | ty.e | ty.e | -1 | e.u | 1 | ty.e | ty.e | |

`X` | -3 | -2 | -1 | 0 | 1 | 2 | 3 |

- e)
`VX`

and`VY`

are integers and`VX`

is not equal to 1 and`VY`

is less than -1.

—`type_error(float, VX).`

- e)
`VX`

and`VY`

are integers and`VY`

is negative and`VX`

is greater than 1 or less than -1

—`type_error(float, VX).`

- e)
`VX`

and`VY`

are integers and`VY`

is negative and`VX`

is not equal to 1, 0, or -1

—`type_error(float, VX).`

2^(-1).byevaluation_error(undefined).

2^(-1).type_error(float, 2).

(informative)

Editorial notes

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

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

Ulrich Neumerkel (editor)

Institut für Computersprachen E185/1

TU Wien

Argentinierstr. 8

A-1040 Wien

Austria

Telephone: +43 1 58801 18513

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

October 2013 - June 2014

Validated HTML