Error in spec ?

Subject: Error in spec ?
From: Joel Katzav <JoelK@xxxxxxxxxxxxxxxxxx>
Date: Fri, 14 Jan 2000 16:56:59 -0000
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)))))


------------------------------------
Dr Joel Katzav
Information Engineer

Griffin Brown Digital Publishing Ltd
Orwell House
Cowley Road
Cambridge
CB4 0PP
United Kingdom

Tel  +44(1223)425730
FAX  +44(1223)425384
Web  http://www.griffinbrown.co.uk  


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


Current Thread