diff options
author | siddharth ravikumar <s@ricketyspace.net> | 2022-08-25 20:05:23 -0400 |
---|---|---|
committer | siddharth ravikumar <s@ricketyspace.net> | 2022-08-25 20:05:23 -0400 |
commit | e72d38e97cb432fd419ef8489a10a3dcffff9ffe (patch) | |
tree | b2adfda78cacfb86a21c9f98314ddda5528ffcd4 /ex/2 | |
parent | ff8dddc38ac6bc8288766bdf36e838cc90cca544 (diff) |
Diffstat (limited to 'ex/2')
-rw-r--r-- | ex/2/51.rkt | 3 | ||||
-rw-r--r-- | ex/2/52.rkt | 23 |
2 files changed, 25 insertions, 1 deletions
diff --git a/ex/2/51.rkt b/ex/2/51.rkt index 8f28d76..347bca3 100644 --- a/ex/2/51.rkt +++ b/ex/2/51.rkt @@ -2,11 +2,12 @@ #lang racket +(provide beside below) + (require "46.rkt") (require "49.rkt") (require "50.rkt") - (define (beside painter1 painter2) (let ((split-point (make-vect 0.5 0.0))) (let ((paint-left diff --git a/ex/2/52.rkt b/ex/2/52.rkt index 92fcf08..bfbc7ac 100644 --- a/ex/2/52.rkt +++ b/ex/2/52.rkt @@ -5,6 +5,7 @@ (require "46.rkt") (require "48.rkt") (require "49.rkt") +(require "51.rkt") (define (wavex->painter) (let* ((h-ls (make-vect 0.426 0.000)) ; head - left start @@ -78,3 +79,25 @@ (make-segment wll-is wll-ie) (make-segment wrl-os wrl-oe) (make-segment wrl-is wrl-ie))))) + + +(define (split left right) + (lambda (painter n) + (if (= n 0) + painter + (let ((smaller ((split left right) painter (- n 1)))) + (left painter (right smaller smaller)))))) + +(define right-split (split beside below)) +(define up-split (split below beside)) + +(define (corner-split-single painter n) + (if (= n 0) + painter + (let ((up (up-split painter (- n 1))) + (right (right-split painter (- n 1)))) + (let ((top-left up) + (bottom-right right) + (corner (corner-split-single painter (- n 1)))) + (beside (below painter top-left) + (below bottom-right corner)))))) |