![]() |
|
In class exam today-- no lecture
Typo on page 6:
;; all-end-to-end? : Polygon -> boolean
;; Given a list of the remaining line segments, return whether these line
;; segments all meet endpoint to endpoint.
(define (all-end-to-end? poly)
(cond
[(empty? poly) false] ; A polygon of no line segments is not closed.
[(cons? poly) (cond
[(empty? (rest poly)) true] ;A single line segment is end-to-end
[(cons? (rest poly)) (and (equal? (LineSeg-p2 (first poly))
(LineSeg-p1 (first (rest poly))))
(all-end-to-end? (rest poly)))])]))
©2003 Stephen Wong