23 hours ago
my attempt to do the exercises in sicp.
Sunday, July 20, 2008
sicp exercise 2.50
;; Exercise 2.50. Define the transformation flip-horiz, which flips painters horizontally, and transformations that rotate painters counterclockwise by 180 degrees and 270 degrees.
(define (flip-horiz painter)
(transform-painter painter
(make-vect 0.0 1.0) ;; new origin
(make-vect 0.0 0.0) ;; new edge1
(make-vect 1.0 1.0))) ;; new edge2
(define (rotate-180-deg-counterclockwise painter)
(transform-painter painter
(make-vect 1.0 1.0) ;; new origin
(make-vect 0.0 1.0) ;; new edge1
(make-vect 1.0 0.0))) ;; new edge2
(define (rotate-270-deg-counterclockwise painter)
(transform-painter painter
(make-vect 0.0 1.0) ;; new origin
(make-vect 0.0 0.0) ;; new edge1
(make-vect 1.0 1.0))) ;; new edge2
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment