Define the procedure
up-split
used by corner-split
. It is similar to right-split
, except that it switches the roles of below
and beside
. up-split
is very similar... Here's right-split
:
(define (right-split painter n) (if (= n 0) painter (let ((smaller (right-split painter (- n 1)))) (beside painter (below smaller smaller)))))To produce
up-split
we simply rename the procedure and recursive call and switch below
and beside
around to give:
(define (up-split painter n) (if (= n 0) painter (let ((smaller (up-split painter (- n 1)))) (below painter (beside smaller smaller)))))Using the
spiral
we produced earlier we can put this to the test:
((up-split spiral 3) window)...produces the following:
No comments:
Post a Comment