-
Notifications
You must be signed in to change notification settings - Fork 0
/
2-51.rkt
45 lines (41 loc) · 1.09 KB
/
2-51.rkt
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#lang racket
(#%require sicp-pict)
(define (beside painter1 painter2)
(let ((split-point (make-vect 0.5 0.0)))
(let ((paint-left
(transform-painter
painter1
(make-vect 0.0 0.0)
split-point
(make-vect 0.0 1.0)))
(paint-right
(transform-painter
painter2
split-point
(make-vect 1.0 0.0)
(make-vect 0.5 1.0))))
(lambda (frame)
(paint-left frame)
(paint-right frame)))))
(paint (beside einstein einstein))
(define (below painter1 painter2)
(let ((split-point (make-vect 1.0 1.0)))
(let ((paint-up
(transform-painter
painter1
(make-vect 0 0.5)
(make-vect 1 0.5)
(make-vect 0 1)
))
(paint-bottom
(transform-painter
painter1
(make-vect 0 0)
(make-vect 1 0)
(make-vect 0 0.5)
)))
(lambda (frame)
(paint-up frame)
(paint-bottom frame)
))))
(paint (below einstein einstein))