3.146 read-option: A compound term with uninstanti-Does this mean that every read-option even as an extension has to have uninstantiated arguments? How many such arguments? Augments?
ated * arguments which amplifies the results produced
by the built-in predicate read-term/3 (8.14.1) and the
bootstrapped * built-in predicates based on it (see 7.10.3).
A processor may support the value of an expression being a value of an additional type instead of an exceptional value.to
A processor may support the value of an expression being some value including a value of an additional type instead of an exceptional value or error.Illustrative example from IF, SWI, YAP:
?- X is (1 rdiv 2) - (1 rdiv 2), integer(X). X = 0.This could be controversial and definitely needs an explicit resolution!
is/2
by (is)/2
.
A term which is the name - followed directly by a numericWhat means "directly" and what is a "numeric constant". 6.1.2 c and d defined them - they have no sign. A numeric constant is either an integer constant (* 6.4.4 *) or a float number token (* 6.4.5 *). There is even a separate Note in 6.4.5 to insist that a float number token is unsigned.
constant denotes the corresponding negative constant.
Compatibility:
integer(- /**/ 1).
: Succeeds in B, Ciao, IF, Minerva,
SICStus, YAP, XSB, GNU (new!). Fails in
ECLiPSe, GNU, SWI.
History:
term = name, integer ; term = name, float number ;The nonterminals
integer
and float number
are defined in 6.4 Tokens. Thus, both permit an optional layout text
sequence.
integer (* 6.4 *) = [ layout text sequence (* 6.4.1 *) ] , integer token (* 6.4.4 *) ; float number (* 6.4 *) = [ layout text sequence (* 6.4.1 *) ] , float number token (* 6.4.5 *) ;Would it have been intended to disallow spaces between
-
and the numeric constant, then the rules in 6.3.1.2 would have been:
term = name, integer token ; term = name, float number token;Further, the Prolog text
- 1.
cannot be misread as a
compound term (-)/1, because in 6.3.4.2 Operators as functors, the
minus sign is explicitly excluded.
term = op, term ; Abstract: f(a) f a Priority: n n n Specifier: fy Condition:If a is a numeric constant, f is not - Condition:The first token of a is not open ct lterm = op, term ; Abstract: f(a) f a Priority: n n n-1 Specifier: fx Condition:If a is a numeric constant, f is not - Condition:The first token of a is not open ct
(',')/2
name token
: Replace
| semicolon token (* 6.4.2 *) | cut token (* 6.4.2 *) ;by
| graphic solo token (* 6.4.3 *) ;(@@@ Also update 6.1.2 b 3)
semicolon token (* 6.4.2 *) = semicolon char (* 6.5.3 *) ; cut token (* 6.4.2 *) = cut char (* 6.5.3 *) ;by
graphic solo token (* 6.4.2 *) = graphic solo char (* 6.5.3 *)
solo char
:
Replace
= cut char (* 6.5.3 *)by
= graphic solo char (* 6.5.3 *)Delete line
| semicolon char (* 6.5.3 *)Replace definitions
cut char (* 6.5.3 *) = "!" ; semicolon char (* 6.5.3 *) = ";" ;by
graphic solo char = "!" | ";" ;or by
graphic solo char = cut char | semicolon char ;
term
and read term
is defined in (* 6.2.2 *) but
also in (* 6.4 *). The definition in 6.4 defines it as a sequence of
tokens. E.g., ")." whereas
3.148 defines it as a term followed by an end token.
single line comment
: A single line comment ends
with a new line char
or with EOF (@@@ better formulation
needed!)
3.140 Prolog data: A sequence of read-terms (seeMaybe extend this by followed by an optional layout sequence (???).
6.2.2).3.141 Prolog text: A sequence of read-terms denoting
directives and clauses (see 6.2, 7.4).
An end char shall be followed by a layout character or %.by
An end char shall be followed by a layout character, %, or it shall be the last character.
dependent
replace
by defined
. But: horizontal tab char is not strictly
needed. See 6.4.2.1. A control escape sequence...
Similarily replace 7.10.2.6
followed by an implementation dependent new line character (6.5, 6.5.4).
domain_error(non_empty_list, [])
be defined?
The format and notation of the definition of each controlIt is not clear, why
construct is consistent with that used for built-in predicates
(8.1) except that a modegoal
indicates that the argument
is a goal rather than a term.
goal
is called a mode. It is type
and mode at the same time, in addition it indicates arguments where
cuts cut to the outside. It indicates arguments that are converted to
a goal. (Maybe its only a mode and no type, because there are no type
errors associated?)
This is the case for 7.8.5.2, 7.8.6.2, 7.8.7.2, 7.8.8.2, but not for 7.8.3.2 and 7.8.9.2.
is
in ['throw(X)'iscauses a goal
E is -(-(_)).
should result in an instantiation error. Subclause a vs. b. This
leads to ambiguities in 5.5.10 extensions. Consider a new evaluable
functor zero/1 such that 0 is zero(_). The argument shall be ignored.
Due to subclause b this would be an instantiation error. but zero(-_)
would be no instantiation error.
Even worse:
X is 1/0+_. X is _+1/0.These examples should never produce a zero_divisor, since subclause b is always "faster" than subclause a. But all systems produce that error.
eof_action(Action)
:
GNU and B is fine, SICStus: wrong error, SWI, YAP: ignored.error
— There shall be a Permission Error
(7.12.2 e) signifying that no more input exists in
this stream.
the sequence of characters forming the atom followed by a layout character could not be input as a valid atom.Alternatively, a dot at the end (without a layout char and without a %) is an end token only.
Alternatively, replace in 6.4.2 Names:
A graphic token shall not be the single character . (dot)by
when . is followed by a layout char or single line
comment.
A graphic token shall not be the single character . (dot)6.4.8 other tokens. Replace
when . is followed by a layout char or single line
comment or when . is the last character
An end char shall be followed by a layout character or aby
%.
An end char shall be followed by a layout character or a
% or it shall be the last character
If the value of this flag is false, inte-This should probably be a resource error. Integers, as defined as type (7.1) in (7.1.2) are accompanied with Note 1 which suggest a resource error "because of exhaustion of resource".
ger arithmetic is always performed correctly (ex-
cept when there is a system_error),
NOTE - The possible values are required to be -M or -(M+1) where M is the value of the flag max_integer.In 13211-1 1.1 Notes it is defined that "Notes in this part of ISO/IEC 13211 have no effect on the language, Prolog text or Prolog processors that are defined as conforming to this part of ISO/IEC 13211". Reasons are only cross references and warnings for differences to existing implementations. This note has however a very strong effect on an implementation. For this reason it should be accompanied with a cross reference towards 7.1.2.
put_char(my_file, C). If a stream is associated with my_file instantiation_error. put_char(st_o, 'ty'). If a stream is associated with st_o type_error(character, ty). put_code(my_file, C). If a stream is associated with my_file instantiation_error. put_code(st_o, 'ty'). If a stream is associated with st_o type_error(integer, ty).
put_byte(my_file, C). If a stream is associated with my_file instantiation_error.
type_error(list, Operator)
.
atom_or_list
or atom_or_atom_list
.
8.1.2.1 has type atom_or_atom_list
. There is also a type
character_list
. atom_or_list
is simpler,
but then it is nowhere used. (This would affect also 7.12.2 b!).
Alternatively it might be preferable to
issue type_error(atom,Xs)
to "advertise" that one does
not need a list.
type_error(list, Operator)
. The
actual type should be changed to atom_or_atom_list
.
a character sequence of Number
which could be output
(7.10.5 b, 7.10.5 c).
But the procedural description:
So the declarative description is not true for "01", while the procedural description succeeds. There are many other examples of that kind.
- b) Else parses the list of the characters of the name of the one-char atoms according to the syntax rules for numbers and negative numbers (6.3.1.1, 6.3.1.2) to give a value N,
Maybe add a new subclause:
Additionally is true, ifNumber
unifies withN
obtained by 8.16.7.1 b.
Nature of defect: the non-terminal token (* 6.4 *)
could
include bar
for reasons of consistency.
Solution: Add bar
to token (* 6.4 *)
.
However, this leads to ambiguity, since ht sep (* 6.4 *)
describes the very same text as bar (* 6.4 *)
So further
clarification would be required.
Nature of defect: The declarative and
procedural descriptions of clause/2 in 8.8.1.1 are inconsistent.
The error is in the procedural description that does not take into
account the sharing of variables between the head and body of a
rule.
Similarly, 7.6.4 body to term conversion is incorrect.
Example:
:- dynamic(a/1). :- dynamic(c/0). a(X) :- b(X). c :- a(X), b(X). ?- clause(a(A), b(B)), A == B. ?- clause(c, ( a(A), b(B) )), A == B.The declarative description demands correctly that both queries should succeed. However, the current procedural description demands that A and B are independent copies of the same variable, thus
A ==
B
fails.
Solution: Reword 7.6.4 and 8.8.1.1.
- (1).
1
, (1)
, ((1))
are all
the same.
- -1.
- 1^3.
A term which is the name-
followed directly by a numeric
constant denotes the corresponding negative constant.
Same for last syntax production for
term =
op, term ;
Abstract: f(a) f a Priority: n n n Specifier: fy
Condition: If a is a numeric constant
the first token of a isinteger
orfloat number
, f is not-
Condition: The first token of a is not open ct
fx
operators.
Add Note 3
3 The condition "If the first token of a isinteger
orfloat number
, f is not-
" defines the use of-
in the term- 1
meaning-1
,- (1)
meaning-(1)
,- -1
meaning-(-1)
, and- 1^2
meaning^(-1,2)
.
System\Query | writeq( 244124086793065425827.0). | X
is 244124086793065425827 -244124086793065425827.0. |
IF V5.1B | 2.4412408679306543e+020 | -32768.0 |
SWI 6.3.18-3 | 2.4412408679306543e+20 | -32768.0 |
YAP 6.3.4 | 2.4412408679306543e+20 | -32768.0 |
B 7.8#5 | 2.44124e+20 | 0.0 |
GNU 1.4.5 | 2.4412408679306543e+20 | ovl. |
SICStus 4.3.5 | 2.4412408679306543E+20 | 0.0 |
Minerva 2.4 | 2.4412408679306543E20 | ovl. |
XSB 3.7 | 244124086793065431040.0000 | ovl. |
Ciao 1.15 | 2.441240867930654e20 | 32768.0 |
IV 1.4.2 | 2.4412408679306543e+020 | 0.0 |
Jekejeke | 2.4412408679306543E20 | 0.0 |
ECLiPSe 6.2#21 | 2.4412408679306543e+20 | 0.0 |
char_code(Ch, c)
may be both a Type Error (8.16.6.3 c)
and a Representation Error (8.16.6.3 d). However, 7.12.2 f only
permits a Representation Error when an implementation defined limit has been breached.But a character can never be a character code.
d)Code
isneither a variable noran integer but not a character code
(7.1.2.2)
—representation_error(character_code).
... is based onaan execution stack
An atomic term, a variable, and a
compound term expressed in functional notation have a
zero priority.
T.
(Paulo
Moura, 2021-08-21)
end_of_file
.
i) If(2022-01-17)C_next
represents an end token (6.4.8) or an optional layout text sequence (6.4.1) at the end @@@, then proceeds to 8.14.1.1 k,...
k) Parses
C_Seq
as a read-term (6.2.2)T.
or parsesC_Seq
as an optional layout text sequence (6.4.1) and @@@T = end_of_file
,
lssIF(n, y) =(Yutaka Ichibangase, 2022-03-13)geqFI(y, n)grtFI(y, n)
leqIF(n, y) =gtrFI(y, n)geqFI(y, n)
gtrIF(n, y) =leqFI(y, n)lssFI(y, n)
geqIF(n, y) =lssFI(y, n)leqFI(y, n)
'/'(7, 35). Evaluates to(2023-03-25)the value 0a value approximately equal to 0.2.
(2023-05-06)2.78182.71828
7.8.8.1 DescriptionSolution is not problematic, as long as there are no redundant solutions. Like in 8.8.2.4 Examples
';'('->'(If, Then), Else)
is true iff (1a)If
is true,
and (1b)Then
is true for the firstsolutionanswer ofIf
, or (2)
If
is false andElse
is true.
current_predicate(Name/1). Succeeds, unifying Name with elk. On re-execution, succeeds, unifying Name with insect. [The order of solutions is implementation dependent]
toward_zero
, since down
is now
realized with (div)/2
.
(:-)/2
and (:-)/1
are neither control
constructs nor built-in. Still, issue a permission error for:
6 ?- (:-B). existence_error(procedure,(:-)/1). 6 ?- (A:-B). existence_error(procedure,(:-)/1). 3 ?- call((A:-B)). existence_error(procedure,(:-)/2). 4 ?- (A:-B). existence_error(procedure,(:-)/2). 1 ?- asserta(((a:-b):-true)). permission_error(modify,static_procedure,(:-)/2). % proposed 2 ?- asserta(((:-b):-true)). permission_error(modify,static_procedure,(:-)/1). % proposedThere is a slight inconsistence, as modification is not permitted which somewhat implies its existence, but then there is an existence error upon calling it. And does this also apply to directives? (2023-07-09)
Scryer,Trealla OK SICStus OK 1,2 - context_error 3,4,5 IF OK 1,2 IV OK 1,2 ex YAP OK 2 call((:-X=1)). X = 1. ECLiPSe i.e. for 6
GNU,Minerva,SWI,Ichiban,B succ 1,2
e)(2023-09-03)Flag
is a valid flag andValue
is inappropriate forFlag
and
there is no appropriate instance ofValue
.
—domain_error(flag_value, Flag+Value).
...
g)Value
is inappropriate forFlag
but an instance ofValue
is appropriate
or
Value
has a component which is a variable and an instantiated component is required
—instantiation_error.
pair_list
in place of list
which then
would also extend 8.1.2.1 with a definition
for pair_list
.
(2023-09-10)