[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: a bug in srfi-43



Quoting Zhu Chongkai <mathematica@xxxxxxxxx>:
> Actually, I just finished porting SRFI-43 to PLT and now 
> it is available at http://webhost.5ewy.com/kellyjm/SRFI-43.zip
> 
> During the porting, I find several bugs in both the document 
> and reference implementation of SRFI-43. The document in 
> http://webhost.5ewy.com/kellyjm/SRFI-43.zip is bug-fixed 
> version by me. The details are:
> 
> Besides (vector-fold (lambda (index counter n) , the two 
> bugs in the document is: 
> 
> (vector-fold-right (lambda (index elt tail) (cons elt tail))
> 
> should be 
> 
> (vector-fold-right (lambda (index tail elt) (cons elt tail))
> 
> and
> 
> (let ((count 0)) 
>    (vector-map (lambda (ignored-index ignored-elt) 
>                  (set! count (+ count 1)) 
>                  count))) 
>                '#(a b)
> 
> should be
> 
> (let ((count 0)) 
>    (vector-map (lambda (ignored-index ignored-elt) 
>                  (set! count (+ count 1)) 
>                  count) 
>                '#(a b))) 

Zhu, thank you for the close reading of the document.  I fixed these two errors
in the SRFI document.  If there are other typos, please let me know.

> And in the reference implementation:
> 
> (define (vector-reverse-copy!
>   ...
>   (between? sstart (+ tstart (- send sstart))
>                                   send)
> ...
> 
> should be 
> 
> (between? tstart sstart (+ tstart (- send sstart)))
> 
> If run the reference implementation, the example
> 
> (vector-map (lambda (i x) (* x x)) 
>             (vector-unfold (lambda (i x) (values x (+ x 1))) 4 1)) 
> 
> returns 
> 
> #(1 4 9 <unspecified>)
> 
> instead of
> 
> #(1 4 9 16)

Perhaps you, or Taylor, could provide a patch which I could apply to the current
reference implementation to fix these problems.

> And the second half of the document, there are no examples,
> which is totally different from the first half. 

There is little to be done about that at this point.  You could write examples,
or better, a test suite and post it to this list.

> (There may be more bugs in the reference implementation because 
> after finding so many bugs, I distrust it and write my own code 
> without reading it carefully. )

It's a large document and a large source file.  It's quite reasonable to expect
a few small kinks.

David