Email list hosting service & mailing list manager

Small issue with reference implementation Jeronimo Pellegrini (06 Nov 2020 15:07 UTC)
Re: Small issue with reference implementation Wolfgang Corcoran-Mathe (06 Nov 2020 17:58 UTC)
Re: Small issue with reference implementation Arthur A. Gleckler (01 Feb 2021 19:03 UTC)
Re: Small issue with reference implementation Wolfgang Corcoran-Mathe (01 Feb 2021 19:52 UTC)
Re: Small issue with reference implementation Arthur A. Gleckler (01 Feb 2021 19:55 UTC)

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.