This preview shows pages 1–3. Sign up to view the full content.
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 Document Sheet1
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))
This is the end of the preview. Sign up
to
access the rest of the document.
This note was uploaded on 03/11/2009 for the course CS 61A taught by Professor Harvey during the Fall '08 term at University of California, Berkeley.
 Fall '08
 Harvey

Click to edit the document details