Hello all,
I think there is a bug in vector-map in the reference implementation of
srfi-43 posted at schemers.org. The reference implementation has:
(define (vector-map f vec . vectors)
(let ((f (check-type procedure? f vector-map))
(vec (check-type vector? vec vector-map)))
(if (null? vectors)
(let ((len (vector-length vec)))
(%vector-map1! f (make-vector len) vec len))
(let ((len (%smallest-length vectors
(vector-length vec)
vector-map)))
(%vector-map2+! f (make-vector len) vectors len)))))
but shouldn't it be
(define (vector-map f vec . vectors)
(let ((f (check-type procedure? f vector-map))
(vec (check-type vector? vec vector-map)))
(if (null? vectors)
(let ((len (vector-length vec)))
(%vector-map1! f (make-vector len) vec len))
(let ((len (%smallest-length vectors
(vector-length vec)
vector-map)))
(%vector-map2+! f (make-vector len) (cons vec vectors)
len)))))
When I run the reference implementation, it doesn't pass the first
vector of multiple vectors into the function I'm mapping over the
vectors. This fix works for me; let me know if I've missed something.
Will