Note: this wiki is now retired and will no longer be updated!
The static final versions of the pages are left as a convenience for readers. Note that meta-pages such as "discussion," "history," etc., will not work.
SICP exercise 2.44
Define the procedure up-split used by corner-split. It is similar to right-split<tt>, except that it switches the roles of <tt>below and beside.
This problem is straightforward. We want to draw the split painters above the original.
#lang scheme (require (planet "sicp.ss" ("soegaard" "sicp.plt" 2 1))) (define (up-split painter n) (if (= n 0) painter (let ((smaller (up-split painter (- n 1)))) (below painter (beside smaller smaller)))))
(paint (up-split einstein 2))