(Previous discussion continued)
Re: SRFI 43 Reference Implementation vector-map bug Taylor Campbell 04 Feb 2005 22:05 UTC

Re: SRFI 43 Reference Implementation vector-map bug Taylor Campbell 04 Feb 2005 22:05 UTC
On Fri, 4 Feb 2005, Will M. Farr wrote:

> Hello,
>
> I just grabbed your reference implementation of SRFI 43 (vector-lib)
> from srfi.schemers.org, and I found a bug in vector-map.  The
> correction is to replace the lines
>
> (loop f target vec (- len 1))  and (loop f target vectors (- len 1))
>
> in %vector-map1! and %vector-map2+! with
>
> (loop f target vec len) and (loop f target vectors len)
>
> You already subtract one when using a given index in
> vector-ref/vector-set, so you don't need to do it entering the loop.  I
> don't know if this matters (most of the ports of vector-lib don't seem
> to use the reference implementation), but I thought you might want to
> know.

Thanks for reporting that bug.  This prompted me to review the code
again, which I noticed several more bugs in.  I could swear I tested my
last modifications before I committed them, but it seems that there was
quite a bit that was somewhat broken.  I've attached a new reference
implementation, which is much less buggy & which I've moved into the
public domain.

(What other Scheme systems did you find implemented SRFI 43 from
scratch, by the way?  The only system I know of that already boasts
SRFI 43 support is Chicken, and there it's just a modification of an
old version of my reference implementation.)