1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
2 ;; about the language level of this file in a form that our tools can easily process.
3 #reader(lib "htdp-intermediate-reader.ss" "lang")((modname 18.1.8) (read-case-sensitive #t) (teachpacks ((lib "draw.ss" "teachpack" "htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "draw.ss" "teachpack" "htdp")))))
4 (define MRPOLY (list (make-posn 20 30)
12 (define (modified-draw-polygon a-poly)
13 (local ((define (draw-polygon a-poly)
15 [(empty? (rest a-poly)) true]
16 [else (connect-dots (cons (last a-poly) a-poly))]))
18 (define (connect-dots a-poly)
20 [(empty? (rest a-poly)) true]
22 (draw-solid-line (first a-poly)
25 (connect-dots (rest a-poly)))]))
29 [(empty? (rest a-poly)) (first a-poly)]
30 [else (last (rest a-poly))]))
31 (define (add-at-end a-poly first-posn)
33 [(empty? (rest a-poly)) (first a-poly)]
34 [else (cons (add-at-end a-poly first-posn) (cons first-posn empty))]))
35 (define (modified-draw-polygon a-poly)
37 [(empty? (rest a-poly)) true]
38 [else (connect-dots (add-at-end a-poly (first a-poly)))])))
39 (modified-draw-polygon a-poly)))
42 (modified-draw-polygon MRPOLY)