Small issue with reference implementation
Jeronimo Pellegrini 06 Nov 2020 09:22 UTC
Hello,
The reference implementation of SRFI-196 has, in 196.sld,
this:
(cond-expand
((library (srfi 133))
(import (only (srfi 133) vector-unfold)))
(else
(begin
;; The "seedless" case is all we need.
(define (vector-unfold f len)
(let ((res (make-vector len)))
(cond ((= i len) res)
(else (vector-set! res i (f i))
(lp (+ i 1)))))))))
The named let for the loop is missing between "(let res ..." and "(cond
...",
(let lp ((i 0))
It should be:
(cond-expand
((library (srfi 133))
(import (only (srfi 133) vector-unfold)))
(else
(begin
;; The "seedless" case is all we need.
(define (vector-unfold f len)
(let ((res (make-vector len)))
(let lp ((i 0))
(cond ((= i len) res)
(else (vector-set! res i (f i))
(lp (+ i 1)))))))))
Also, the cont-expand only checks for SRFI 133, but SRFI 43 also
brings vector-unfold, which seems to work in this case (unless
I've missed something).
J.