Sheet1
Page 1
(define (upsplit painter n)
(if (= n 0)
painter
(let ((smaller (upsplit painter ( n 1))))
(below painter (beside smaller smaller)))))
(define (split major minor)
(define (splitter painter n)
(if (= n 0)
painter
(let ((smaller (splitter painter ( n 1))))
(major painter (minor smaller smaller)))))
splitter)
(define makevect cons)
(define xcorvect car)
(define ycorvect cdr)
(define (addvect v1 v2)
(makevect (+ (xcorvect v1) (xcorvect v2))
(+ (ycorvect v1) (ycorvect v2))))
(define (subvect v1 v2)
(makevect ( (xcorvect v1) (xcorvect v2))
( (ycorvect v1) (ycorvect v2))))
(define (scalevect s v)
(makevect (* s (xcorvect v))
(* s (ycorvect v))))
(define (makeframe origin edge1 edge2)
(list origin edge1 edge2))
(define originframe car)
(define edge1frame cadr)
(define edge2frame caddr)
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentSheet1
Page 2
(define (makeframe origin edge1 edge2)
(cons origin (cons edge1 edge2)))
(define originframe car)
(define edge1frame cadr)
(define edge2frame cddr)
(
(define makesegment cons)
(define startsegment car)
(define endsegment cdr)
(define framepainter
(segments>painter
(list (makesegment (makevect 0 0) (makevect 0 1))
(makesegment (makevect 0 1) (makevect 1 1))
(makesegment (makevect 1 1) (makevect 1 0))
(makesegment (makevect 1 0) (makevect 0 0)))))
(define Xpainter
(segments>painter
(list (makesegment (makevect 0 0) (makevect 1 1))
(makesegment (makevect 1 0) (makevect 0 1)))))
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '08
 Harvey
 makesegment

Click to edit the document details