]> git.rkrishnan.org Git - sicp.git/blob - src/sicp/ex2_51.clj
Solution to 4.44. A bit too verbose. Can be improved by better
[sicp.git] / src / sicp / ex2_51.clj
1 (ns sicp.ex2_51
2   (:use [clojure.test]
3         [sicp.ch2_2 :only (transform-painter)]))
4
5 (defn below1 [painter1 painter2]
6   (let [paint-low (transform-painter painter1
7                                      (make-vect 0 0)
8                                      (make-vect 1 0)
9                                      (make-vect 0 0.5))
10         paint-high (transform-painter painter2
11                                       (make-vect 0 0.5)
12                                       (make-vect 1 0)
13                                       (make-vect 0 1))]
14     (fn [frame]
15       (paint-low frame)
16       (paint-high frame))))
17
18 (defn below2 [painter1 painter2]
19   (rotate90 (beside (rotate270 painter1) (rotate270 painter2))))