;; reset-first-n-pixels: vector number color -> side effect, changing vector
;; Set the first n pixels in the vector to the specified color
(define reset-first-n-pixels
(lambda (line n color)
(cond
((<= n 0) 'return-whatever-we-are-done)
(else (begin
(vector-set! line (sub1 n) color)
; The sub1 allows for zero-based indexing
(reset-first-n-pixels line (sub1 n) color))))))
David G. Kay, 406B Computer Science
Monday, December 6, 2004 -- 6:57 AM