-
Notifications
You must be signed in to change notification settings - Fork 0
/
ex_2_50.clj
30 lines (26 loc) · 1005 Bytes
/
ex_2_50.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
(ns sicp.chapter-2.part-2.ex-2-50
(:require
[sicp.chapter-2.part-2.book-2-2 :as b22]
[sicp.chapter-2.part-2.ex-2-46 :as ex-2-46]))
; Exercise 2.50
;
; Define the transformation flip-horiz, which flips painters horizontally,
; and transformations that rotate painters counterclockwise by 180 degrees and 270 degrees.
(defn flip-horiz
[painter]
(b22/transform-painter painter
(ex-2-46/make-vect 1.0 0.0)
(ex-2-46/make-vect 0.0 0.0)
(ex-2-46/make-vect 1.0 1.0)))
(defn rotate-180-cc
[painter]
(b22/transform-painter painter
(ex-2-46/make-vect 1.0 1.0)
(ex-2-46/make-vect 1.0 0.0)
(ex-2-46/make-vect 0.0 1.0)))
(defn rotate-270-cc
[painter]
(b22/transform-painter painter
(ex-2-46/make-vect 0.0 1.0)
(ex-2-46/make-vect 1.0 1.0)
(ex-2-46/make-vect 0.0 0.0)))