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 T unifies with ^(_, G) then ...by
a) If T has 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 termA = V
, and
(2)V
is a named variable of the term, and (3)A
is an
atom whose name is the characters ofV
, and (4) the elements appear in the order of their variablesV
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 termA = 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 ofV
.
@@@ idem
numbervars(Bool)
numbervars(Bool)
- IffBool
(7.1.4.2) istrue
a
term of the form'$VAR'(N)
, whereN
is an a non-negative integer, 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 variableV
is output as the unquoted atomA
iff a termA = V
is an element of the listVN_list
. If more than one element applies, the leftmost is used.
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.
a1) IfTerm
is a variable and there is an effective write-optionvariable_names(VN_list)
and there is an elementA = Term
of the listVN_list
withA
an atom, thenA
is output with effective write-optionquoted(false)
.
Term
has the
form '$VAR'(N)
for some pos-e2) Else ifTerm
has the form'{}'(Arg)
, and there is an effective write-optionignore_ops(false)
, thenTerm
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) If Term
has a principal functor ...
by Else if
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.
2) Each argument of the term is output by recursively applying these rules. An argument 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 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 byH
and bodyB
,
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 variable or 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 theOptions
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
bywrite_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 Y is not. Replace
by 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 |
VX
and VY
are integers
and VX
is not equal to 1 and VY
is less than
-1.
type_error(float, VX).
VX
and VY
are integers
and VY
is negative
and VX
is greater than 1 or less than -1
type_error(float, VX).
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). evaluation_error(undefined).by
2^(-1). type_error(float, 2).