You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
634 B

(load "displaylib.scm")
(title "Exercise 2.45")
(doc "Right-split and up-split can be expressed as instances of a general splitting operation. Define a procedure split with the property that evaluating
(define right-split (split beside below))
(define up-split (split below beside))
produces procedures right-split and up-split with the same behaviors as the ones already defined.")
(define (split transform1 transform2)
(lambda (painter n)
(if (= n 0)
(let ((smaller ((split transform1 transform2) painter (- n 1))))
(transform1 painter (transform2 smaller smaller))))))