Re: Error in spec ?

Subject: Re: Error in spec ?
From: Matthias Clasen <clasen@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 14 Jan 2000 19:47:06 +0100
I think this has been noticed before, since when looking into 
dsssl/builtins.dsl in openjade-1.3, I find:

(define (node-list-head nl k)
  (if (zero? k)
      (empty-node-list)
      (node-list (node-list-first nl)
                 (node-list-head (node-list-rest nl) (- k 1)))))
       ;;                         ^^^^^^^
       ;;                         missing in standard

I'm not sure who first spotted it though.

> 
> I suspect there is an error in the DSSSL spec.
> 
> node-list-head (p. 136) is supposed to return a node-list comprising the
> first k members of nl. However, it is defined as follows:
> 
> (define (node-list-head nl i)
> 	(if (zero? i)
> 		(empty-node-list)
> 		(node-list (node-list-first nl)
> 			(node-list-head nl (- i 1)))))
> 
> This returns a node-list in which the first member of nl is repeated i
> times.
> 
> I think that the following function corrects this error: 
> 
> (define (node-list-head nl i)
> 	(if (zero? i)
> 		(empty-node-list)
> 		(node-list (node-list-first nl)
> 	(node-list-head (node-list-rest nl) (- i 1)))))
> 


-- 
Matthias Clasen, 
Tel. 0761/203-5606
Email: clasen@xxxxxxxxxxxxxxxxxxxxxxxxxx
Mathematisches Institut, Albert-Ludwigs-Universitaet Freiburg


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread