[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Errors in the SRFI documents for SRFI-13 and 14
[I hope these lists are still active]
I am currently doing implementations of SRFI-13 and SRFI-14 for Guile,
and stumbled across errors (at least I think so) in the SRFI document.
Maybe someone here can enlighten me:
The following is stated:
``A positive value restricts the return value to the range [0,bound).''
Below, as example code, there is given:
(define (char-set-hash cs . maybe-bound) 1)
which would break if the procedure was called as follows:
(char-set-hash cs 1)
because the returned value has to be in [0,1), but 1 is returned.
`string-hash' and `string-hash-ci' have the same errors.
2. `char-set-unfold' and `char-set-unfold!'
They are specified as
char-set-unfold f p g seed [base-cs] -> char-set
char-set-unfold! f p g seed base-cs -> char-set
but the example implementation is given as
(define (char-set-unfold p f g seed base-cs)
(char-set-unfold! p f g seed (char-set-copy base-cs)))
(define (char-set-unfold! p f g seed base-cs)
(let lp ((seed seed) (cs base-cs))
(if (p seed) cs ; P says we are done.
(lp (g seed) ; Loop on (G SEED).
(char-set-adjoin! cs (f seed)))))) ; Add (F SEED) to set.
Note the different order of the predicate and seed mapping procedures.
[string-unfold is defined correctly]
I wonder if changes to the SRFI document are allowed, if they only
correct errors and not introduce incompatibilities. If yes, they
should be made.