Re: a bug in srfi-43 Zhu Chongkai (28 Feb 2005 01:14 UTC)
|
Re: a bug in srfi-43
David Van Horn
(28 Feb 2005 05:56 UTC)
|
Re: a bug in srfi-43 Zhu Chongkai 28 Feb 2005 01:13 UTC
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))) 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) 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 >>>vector-fold: >>> >>>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. > >David > = = = = = = = = = = = = = = = = = = = = Zhu Chongkai http://www.neilvandyke.org/mrmathematica/