Rice University

COMP 210: Principles of Computing and Programming

Lecture #13       Fall 2003

In class exam today-- no lecture

Do not dwell on a problem -- move on to the next one!

Do not write any test cases.

Do not write contracts, purposes or headers if they are given to you.
Do write them if they are not supplied!

Focus on simple, straight-forward answers.

If you don't understand, ASK!!
Don't pound your head against the wall
--
the wall always wins!

 

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)))])]))

 

 

OFFICES:
Wong: DH3102 -- directly above the classroom
Greiner: DH3118 -- directly above the other classroom
.

 

 

©2003 Stephen Wong