SICStus Prolog now complies with Technical Corrigenda 1 and 2 to the International Standard ISO/IEC 13211-1 (PROLOG: Part 1—General Core).
throw/1
now throws its argument as is. raise_exception/1
however transforms SICStus error terms into ISO (error/2
)
exceptions. Unless a forged SICStus error term is thrown by throw/1
,
the net behavior is unchanged.
subsumes_term/2
is a new standard built-in predicate, aliased by
terms:subsumeschk/2
, and is now correct in case the arguments
share variables.
term_variables/2
is a new standard built-in predicate, aliased by
terms:term_variables_bag/2
, and performs conformant error
handling. terms:term_variables/2
has been renamed to
terms:term_variables_set/2
.
acyclic_term/2
, previously in library(terms)
, is now a
standard built-in predicate.
callable/1
, ground/1
,
retractall/1
, call/n
, false/0
are now standard.
number_codes/2
, number_chars/2
,
atom_codes/2
, and atom_chars/2
now perform conformant
error handling. The syntax for numbers has changed
(plus sign is no longer allowed1). Full ISO syntax allowed in
Codes/Chars, including layout and comments.
length/2
, keysort/2
, sort/2
,
compare/3
, and open/[3,4]
now perform conformant error handling.
call/1
, assert/1
and similar
predicates now perform conformant error handling when encountering an
invalid goal.
div
Y is a new standard arithmetic expression,
whose value is the integer quotient of X and Y,
rounded downwards to the nearest integer.
xor(
X,
Y)
is the standard syntax for X \
Y.
^
Y is a new standard arithmetic expression,
whose value is X raised to the power of Y, represented as a float
if any of X and Y is a float; otherwise, as an integer.
pi
is a new standard arithmetic expression,
whose value is approximately 3.14159.
+
is a new standard prefix operator declared as :-op(200,
fy, [+])
.
writeq(^(*,\+))
outputs ‘(*)^(\+)’.
clause/[2,3]
and retract/1
return a close equivalent to
the asserted clause, as required by the standard. This also affects
listing/[0,1]
.
read_term/[2,3]
option singletons/1
is now
conformant. It now includes
all named variables that occur only once in the read term, as required
by the standard.
It used to exclude some variables for which singleton
warnings should not be emitted, e.g. ‘_A’. Any such filtering
must now be performed by the caller instead.
read_term/[2,3]
options variable_names/1
and
singletons/1
now order their entries by the order the variable
occurred in the input term, i.e. in the same order as the
variables/1
option. In previous releases the order was
undefined, and unpredictable. The new ordering is permitted, but not
(yet) required, by the standard.
read_term/[2,3]
, now correctly
parses some valid input that used to give syntax error.
write_term/[2,3]
option numbervars(true)
(also used
by writeq/[1,2]
and others), is now standard compliant and only
affects terms $VAR(
N)
when N is a non-negative
integer. In particular it no longer does special processing when
N is an atom.
To supply names for variables when writing a term you can use the new
option variable_names/1
that takes a list of
Name=
Variable pairs, exactly like the list produced
by the read_term/[2,3]
option variable_names/1
.
To get the legacy behavior, where '$VAR'(
Name)
is written
as Name when Name is an atom, you can use the new option
legacy_numbervars(true)
which behaves like
numbervars(true)
did in earlier releases.
[1] A term written by a previous
release will still be read correctly by this release. A term written
by this release will be read correctly by releases prior to 4.3,
except if the written term contains a prefix +
operator with a
non-negative number as argument.