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

Re: a bug in srfi-43

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))


(let ((count 0)) 
   (vector-map (lambda (ignored-index ignored-elt) 
                 (set! count (+ count 1)) 
               '#(a b)

should be

(let ((count 0)) 
   (vector-map (lambda (ignored-index ignored-elt) 
                 (set! count (+ count 1)) 
               '#(a b))) 

And in the reference implementation:

(define (vector-reverse-copy!
  (between? sstart (+ tstart (- send sstart))

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)) 


#(1 4 9 <unspecified>)

instead of

#(1 4 9 16)

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

(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. )

Best regards, 
======= At 2005-02-28, 02:06:48 David Van Horn wrote: =======

>Taylor Campbell wrote:
>> On Thu, 24 Feb 2005, Zhu Chongkai wrote:
>>>In Section 4.4. Iteration, the final example of 
>>>Count the number of even numbers in vec. 
>>>(vector-fold (lambda (index n counter) 
>>>                 (if (even? n) (+ counter 1) counter)) 
>>>               0 vec) 
>>>but shouldn't it be 
>>>(vector-fold (lambda (index counter n) 
>> Yes, that is correct.  I'm not sure of the correct protocol to fix
>> things post-finalization, so I'll just cc this to the editors and hope
>> that they fix SRFI 43...
>These sorts of typographical errors can be fixed after finalization.  I went 
>ahead and updated the document.  Thanks for the notice.

= = = = = = = = = = = = = = = = = = = =
Zhu Chongkai