R6RS Errata

Revised6 Report on the Algorithmic Language Scheme

§ 1.13
The description of the example program mentions procedures get-bytes-all and put-bytes, which should be get-bytevector-all and put-bytevector.
The example code is missing a call to close-port, and should be:
#!r6rs
(import (rnrs base)
        (rnrs io ports)
        (rnrs programs))
(let ((p (standard-output-port)))
  (put-bytevector p
                  (call-with-port
                      (open-file-input-port
                        (cadr (command-line)))
                    get-bytevector-all))
  (close-port p))
§ 4
The term "read syntax" mentioned in the introduction of the chapter should be "datum syntax".
§ 4.1
The sentence:

"Some non-terminal names refer to the Unicode scalar values of the same name: <character tabulation> (U+0009), <linefeed> (U+000A), <carriage return> (U+000D), <line tabulation> (U+000B), <form feed> (U+000C), <carriage return> (U+000D), <space> (U+0020), <next line> (U+0085), <line separator> (U+2028), and <paragraph separator> (U+2029)."

contains a duplicate "<carriage return> (U+000D)", which should be elided.
§ 4.2.1
The rule

<decimal 10> -> <digit 10>+ . <suffix>

is redundant.
In the production for <string element>, the two occurrences of <intraline whitespace> should have a * after them.
§ 4.2.1, § 4.2.8
The rules for <number> suggest that the lexical syntax for the external representations of number objects is case-sensitive, with a number of specific exceptions, while the first apragraph of § 4.2.8 claims that case is not significant in external representations of number objects. This should be resolved by making case generally insignificant in the external representation of number objects.
§ 4.2.6
The sentence

"Case is significant in #\<character>, and in #\<character name>, but not in #\x<hex scalar #value>." is worded confusingly.

It should be

"Case is significant in #\<character>, and in #\<character name>, but not the in the <hex scalar #value> part of #\x<hex scalar #value>."

§ 4.2.8
The following sentence should be added:

"The -nan.0 literal also represents a NaN."

§: 5.10
The sentence

"An object fetched from a location, by a variable reference or by a procedure such as car, vector-ref, or string-ref, is equivalent in the sense of eqv? (section 11.5) to the object last stored in the location before the fetch."

should be amended by:

", except when that object is a procedure. When the object is a procedure, the object fetched from the location will also be a procedure that behaves identically to the procedure last stored in the location, but it is possible that it is not the same object."

§ 7.3
The (stack) example library is missing an import of (rnrs mutable-pairs).
§ 11.3
The description of the procedures is out of order and should be:

"equal, monotonically increasing, monotonically nondecreasing, monotonically decreasing, or monotonically nonincreasing"

There is an occurrence of the name fl< which should be fl<?
§ 11.4.5
The first example for case is slightly confusing, as it suggests that 1 is a composite number: It should be elided from the second branch of the case.
§ 11.5
In the definition of the behavior of eqv? on inexact numbers - both #t and #f cases - the phrase

" [...] as a finite composition of Scheme's standard arithmetic procedures."

should be augmented by:

", as long as the evaluation of that application does not involve NaN."

The following sentence should be elided:

"Furthermore, a constant may be copied at any time by the implementation so as to exist simultaneously in different sets of locations, as noted in section 11.4.1."

The following example for eq?
(eq? car car) => #t
should be replaced by
(eq? car car) => unspecified
§ 11.6
In the entry for list-ref, "list-tail" should be replaced by "list-ref".
§ 11.7.4
The two examples for < and > on infinities have extra parentheses.
The examples for min and max involving infinities should be prefixed by:

"For any real number object x that is not a NaN:"

The entries for inexact, exact, min, and max mention a condition type &implementation-violation, which should be &implementation-restriction.
The entry for rationalize says "returns a the a number object": the "the" should be elided.
The respectively second templates for / and - should have parameter lists z1 z2 z3 ... respectively.
The example:
(imag-part 1.1+2.2i) =>  2.2i ; approximately
should be replaced by:
(imag-part 1.1+2.2i) =>  2.2 ; approximately
In the description of the div, mod etc., the wording

"In each case, x1 must be neither infinite nor a NaN, and x2 must be nonzero; otherwise, an exception with condition type &assertion is raised."

should be replaced by:

"If x1 and x2 are exact, x2 must be nonzero. In the cases where the mathematical requirements in section 11.7.3 cannot be satisfied by any number object, either an exception is raised with condition type &implementation-restriction, or unspecified number objects (one for for div mod, div0 and mod0, two for div-and-mod and div0-and-mod0) are returned."

The example
(expt 0 5+.0000312i)   =>  0
should be replaced by:
(expt 0 5+.0000312i)   =>  0.0
The note for string->number should be replaced by:

"If the arguments to string->number are a string and a valid radix as specified, it must produce a number object or #f ; it may not raise an exception."

(I.e., string->number may raise an exception if the argument is not a string.)

§ 11.9
The append procedure can be called with zero arguments. Thus, in the description of append, a template (append) should be added.

The sentence at the end of the entry for append should be clarified to:

"The return value is made from new pairs for all arguments but the last; the last is merely placed at the end of the new structure."

§ 11.17
Two of the examples involve calls to sqrt for which Scheme implementations are allowed to return either exact or inexact results, which makes the examples potentially confusing.
§ 11.19
The wording for the second bullet for vector patterns says "F is a vector of n or more elements", but should say "F is a vector of n elements".
The last example in this section:
p => (15 5)
should be:
p => (15 . 5)
§ D
The example is missing the following line at the end:
(close-output-port (current-output-port))

Standard Libraries

§ 1.2
In the description of string-titlecase, the words "via char-titlecase" should be removed. (I.e. string-titlecase should use the full mapping, not just the scalar-value-to-scalar-value mapping.)
The examples:
(string-titlecase "r6rs") => "R6Rs"
(string-titlecase "R6RS") > "R6Rs"
should be replaced by:
(string-titlecase "r6rs") => "R6rs"
(string-titlecase "R6RS") > "R6rs"
§ 2.4
The sentence

"The length of bytevector or, respectively, of list must be divisible by size."

should be replaced by

"The length of bytevector must be divisible by size."

§ 2.6
In the entry for bytevector-s32-native-set!, the interval for n should be {-231, ..., 231 - 1} instead of {-231, ..., 232 - 1}.
§ 2.7
In the entry for bytevector-s64-native-set!, the interval for n should be {-263, ..., 263 - 1} instead of {-263, ..., 264 - 1}.
§ 2.9
In the entry for utf16->string utf32->string, the argument endianness-mandatory should be spelled endianness-mandatory?.
The sentence in the specification of utf16->string

"Bytevector is decoded according to UTF-16BE or UTF-16LE:"

should be replaced by

"Bytevector is decoded according to UTF-16, UTF-16BE, UTF-16LE, or a fourth encoding scheme that differs from all three of those as follows:"

The sentence in the specification of utf32->string

"Bytevector is decoded according to UTF-32BE or UTF-32LE:"

should be replaced by

"Bytevector is decoded according to UTF-32, UTF-32BE, UTF-32LE, or a fourth encoding scheme that differs from all three of those as follows:"

§ 3
The example
(for-all even? '(3 1 4 1 5 9 . 2)) => #f
should be removed, as this call to for-all may raise an exception.
§ 4
The example for the call to vector-sort! is incorrect; it should be:
(define v (vector 3 5 2 1))
(vector-sort! < v) => unspecified
v => #(1 2 3 5)
§ 6.1
The sentence

"Each call to a record constructor returns a new record with a fresh location [...]"

should be replaced by:

"Each call to a record constructor of a mutable record type returns a new record with a fresh location [...]"

The sentence

If obj1 and obj2 are both records of the same record type, and are the results of two separate calls to record constructors, then eqv? returns #f.

should be replaced by:

If obj1 and obj2 are both records of the same mutable record type, and are the results of two separate calls to record constructors, then eqv? returns #f.

§ 6.2
In the parent-rtd clause, analogously to make-record-constructor-descriptor, either <parent rtd> or <parent cd> can evaluate to #f, according to rules analogous to those for make-record-constructor-descriptor.
§ 6.3
The sentence

"If rtd is a base record type and protocol is a procedure, parent-constructor-descriptor must be #f."

should be replaced by:

"If rtd is a base record type parent-constructor-descriptor must be #f."

The sentence:

"If rtd is an extension of another record type, and parent-constructor-descriptor or the protocol of parent-constructor-descriptor is #f, protocol must lso be #f, and a default constructor descriptor as described above is also assumed."

should be replaced by:

"If rtd is an extension of another record type and parent-constructor-descriptor is #f, parent-constructor-descriptor is treated as if it were a constructor descriptor for the parent rtd of rtd with a default protocol."

The examples for calls to make-point/abs and an example for cpoint-rgb are missing trailing parentheses, and should go like this:
(point-x (make-point/abs -1 -2)) => 1
(point-y (make-point/abs -1 -2)) => 2
...
(cpoint-rgb (make-cpoint -1 -3 'red)) => (rgb . red)
§ 7.1
The sentence

"If every <cond clause>'s <test> evaluates to #f and there is no else clause, then raise is re-invoked on the raised object [...]"

should be replaced by

"If every <cond clause>'s <test> evaluates to #f and there is no else clause, then raise-continuable is invoked on the raised object [...]"

The second example for raise is missing a parenthesis after make-violationand should go like this:
(guard (con
         ((error? con)
          (if (message-condition? con)
              (display (condition-message con))
              (display "an error has occurred"))
          'error))
  (raise
    (condition
      (make-violation)
      (make-message-condition "I am an error"))))
  => &violation exception
§ 7.2.1
The examples for cond1-x cond2-y are lacking trailing parentheses and should go like this:
(cond1-x (condition foo bar)) => foo
(cond2-y (condition foo bar)) => bar
§ 8.1
The argument port in the template for make-i/o-port-error inappropraitely implies that the argument must be a port, in conflict with the description. The three occurrences of port in the description should be replaced with pobj.
§ 8.2.4
The occurrences of port in the templates for make-i/o-decoding-error and make-i/o-encoding-error should be replaced with pobj, and the occurrences of char in the description of make-i/o-encoding-error should be replaced with cobj. The description of make-i/o-encoding-error should say that cobj should be the character that could not be encoded.
§ 8.2.7
The following note should be added to the description of make-custom-textual-input-port: ``Even when the get-position procedure is supplied, the port-position procedure cannot generally return a precise value for a custom textual input port if data has been read from the port.''
§ 8.2.10
In the description of make-custom-binary-output-port, the sentence

"If count is 0, the write! procedure should have the effect of passing an end-of-file object to the byte sink."

should be deleted (it was left over from an earlier revision). The corresponding sentence in the description of make-custom-textual-output-port should also be deleted.
§ 8.2.13
The following note should be added to the description of make-custom-binary-input/output-port: ``Unless both get-position and set-position! procedures are supplied, a put operation cannot precisely position the port for output to a custom binary input/output port after data has been read from the port.''
The following note should be added to the description of make-custom-textual-input/output-port: ``Even when both get-position and set-position! procedures are supplied, the port-position procedure cannot generally return a precise value for a custom textual input/output port, and a put operation cannot precisely position the port for output, after data has been read from the port.''
§ 11.2
In the entry for fx-, the exception mentioned should have condition type &implementation-restriction (as explained in the introduction of that section), not &assertion.
The specification of fxcopy-bit-field should be clarified to say

"the bits in fx4 from position 0 (inclusive) to position fx3 - fx2 (exclusive)"

instead of just

"the corresponding bits in fx4".

The code illustrating the computation performed by fxcopy-bit-field should be replaced by the following:
(let* ((n     fx1)
       (start fx2)
       (end   fx3)
       (from  fx4)
       (mask1 (fxarithmetic-shift-left -1 start))
       (mask2 (fxnot
               (fxarithmetic-shift-left -1 end)))
       (mask (fxand mask1 mask2))
       (mask3 (fxnot (fxarithmetic-shift-left
                       -1 (- end start)))))
  (fxif mask
        (fxarithmetic-shift-left (fxand from mask3)
                                 start)
        to))
In the code specifying the computation for fxbit-count, "ei" should be "fx".
In the specification of fxbit-set?, the sentence

"Fx2 must be non-negative and less than (fixnum-width)."

should be replaced by

"Fx2 must be non-negative."

Also, the code describing its computation should be changed to:
(if (fx>=? fx2 (fx- (fixnum-width) 1))
    (fxnegative? fx1)
    (not
      (fxzero?
         (fxand fx1
                (fxarithmetic-shift-left 1 fx2)))))
In the specification of fxcopy-bit, the sentence

"Fx2 must be non-negative and less than (fixnum-width)."

should be replaced by

"Fx2 must be non-negative and less than w - 1."

In the entry for fxrotate-bit-field, the sentence

"Fx4 must be less than the difference between fx3 and fx2."

should be changed to:

"Fx4 must be less than or equal to the difference between fx3 and fx2."

The code used to illustrate the computation performed by fxrotate-bit-field should be changed to:
(let* ((n     fx1)
       (start fx2)
       (end   fx3)
       (count fx4)
       (width (fx- end start)))
  (fxcopy-bit-field n start end
    (fxior
      (fxarithmetic-shift-left
        (fxbit-field n start (fx- end count)) count)
      (fxarithmetic-shift-right
        (fxbit-field n start end) (fx- width count))))))
§ 11.3
The examples for fl=? etc. lack the trailing ? in their names.
In the description of fldiv etc, the wording:

"For zero divisors, these procedures may return a NaN or some unspecified flonum."

should be replaced by

"In the cases where the mathematical requirements in section 11.7.3 cannot be satisfied by any number object, either an exception is raised with condition type &implementation-restriction, or unspecified flonums (one for for fldiv flmod, fldiv0 and flmod0, two for fldiv-and-mod and fldiv0-and-mod0) are returned."

In the description of flexpt, the sentence

"If fl1 is zero, then the result is zero."

should be replaced by:

"If fl1 and fl2 are both zero, the result is 1.0. If fl1 is zero and fl2 is positive, the result is zero. If fl1 is zero and fl2 is negative, the result may be a NaN, or may be some unspecified flonum."

The make-no-infinities-violation and make-no-nans-violation procedures take no arguments.
§ 11.4
In the specification of bitwise-copy-bit,

"[...] by the ei2 bit of ei3"

should be replaced by

"[...] by ei3"

In the specification of bitwise-copy-bit-field,

"... fixnum result of the following computation:"

should be replaced by

"... result of the following computation:"

The specification of bitwise-copy-bit-field should be clarified to say

"the bits in ei4 from position 0 (inclusive) to position ei3 - ei2 (exclusive)"

instead of just

"the corresponding bits in ei4".

§ 12.1
The remark "An algebra that defines how marks and substitutions work more precisely is given in section~2.4 of Oscar Waddell's PhD thesis." is somewhat misleading and should be qualified as follows:

"Note, however, that Waddell's thesis describes slightly different semantics for bound-identifier=? - it specifies that for two identifiers to be equal in the sense of bound-identifier=?, they must have the same marks and be equal in the sense of free-identifier=?, whereas this report requires instead that they must have the same marks and have the same name."

§ 12.4
The last example in this section:
p => (15 5)
should be:
p => (15 . 5)
§ 12.6
The example definition of the include macro uses
(open-file-input-port fn)
to open the file, which would result in a binary input port. Instead, a textual input port should be opened, for example via:
(open-file-input-port fn (file-options) (buffer-mode block) (native-transcoder))
§ 12.8
The sample definition of identifier-syntax is incorrect and should be as follows:
(define-syntax identifier-syntax
  (lambda (x)
    (syntax-case x (set!)
      [(_ e)
       #'(lambda (x)
           (syntax-case x ()
             [id (identifier? #'id) #'e]
             [(_ x (... ...)) #'(e x (... ...))]))]
      [(_ (id exp1) ((set! var val) exp2))
       (and (identifier? #'id) (identifier? #'var))
       #'(make-variable-transformer
          (lambda (x)
            (syntax-case x (set!)
              [(set! var val) #'exp2]
              [(id x (... ...)) #'(exp1 x (... ...))]
              [id (identifier? #'id) #'exp1])))])))
§ 13.2
The parameter to hashtable? should be obj instead of hashtable - hashtable? can be called with any object.
The description of hashtable-entries should contain an explanatory note saying that the order of the entries in the result vectors may be different from the example.
§ 14
The word "value" in the description of enum-set-indexer should be replaced with "symbol" to avoid implying that the procedure returned by enum-set-indexer accepts arbitrary types of values.
There's an extra parenthesis at the end of the code example for enum-set-projection.
§ 16
The examples for environment both lack imports of (rnrs eval).
§ 16
The requirement that eval raise an exception with condition type &assertion if applied to an expression containing an assignment to one of the variables in the environment should be replaced with a requirement that it raise an exception with condition type &syntax for consistency with treatement of similar situations as syntax violations in Section 7.1 of the base document.