-
Notifications
You must be signed in to change notification settings - Fork 1
/
2.52.tex
68 lines (65 loc) · 2.36 KB
/
2.52.tex
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
\documentclass[a4paper,12pt]{article}
\usepackage{listings}
\lstset{language=Lisp}
\begin{document}
\begin{lstlisting}
(define wave
(segments->painter
(list
(make-segment (make-vector 5/12 2/3)
(make-vector 1/3 5/6))
(make-segment (make-vector 1/3 5/6)
(make-vector 5/12 1))
(make-segment (make-vector 7/12 1)
(make-vector 2/3 5/6))
(make-segment (make-vector 2/3 5/6)
(make-vector 7/12 3/3))
(make-segment (make-vector 7/12 2/3)
(make-vector 2/3 2/3))
(make-segment (make-vector 2/3 2/3)
(make-vector 1 1/2))
(make-segment (make-vector 1 1/3)
(make-vector 7/12 1/2))
(make-segment (make-vector 7/12 1/2)
(make-vector 0 2/3))
(make-segment (make-vector 0 5/9)
(make-vector 1/2 1/3))
(make-segment (make-vector 1/2 1/3)
(make-vector 0 4/9))
(make-segment (make-vector 0 1/3)
(make-vector 5/12 1/2))
(make-segment (make-vector 5/12 1/2)
(make-vector 1/3 7/12))
(make-segment (make-vector 1/3 7/12)
(make-vector 1/6 1/2))
(make-segment (make-vector 1/6 1/2)
(make-vector 0 2/3))
(make-segment (make-vector 0 5/6)
(make-vector 1/6 7/12))
(make-segment (make-vector 1/6 7/12)
(make-vector 1/3 2/3))
(make-segment (make-vector 1/3 2/3)
(make-vector 5/12 2/3))
;; Adding a smile
(make-segment (make-vector 5/12 5/6)
(make-vector 11/24 3/4))
(make-segment (make-vector 11/24 3/4)
(make-vector 13/24 3/4))
(make-segment (make-vector 13/24 3/4)
(make-vector 7/12 5/6)))))
(define (corner-split painter n)
(if (= n 0)
painter
(let ((up (up-split painter (- n 1)))
(right (right-split painter (- n 1))))
(let ((top-left (beside painter up))
(bottom-right (below painter right))
(corner (corner-split painter (- n 1))))
(beside (below painter top-left)
(below bottom-right corner))))))
(define (square-limit painter n)
(let ((quarter (corner-split painter n)))
(let ((half (beside quarter (flip-horiz quarter))))
(below half (flip-vert half)))))
\end{lstlisting}
\end{document}