1 day ago

my attempt to do the exercises in sicp.

## Saturday, July 19, 2008

### sicp exercise 2.45

; Exercise 2.45. 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 pos1 pos2)

(lambda (painter m)

(define (iter n)

(if (= n 0)

painter

(let ((smaller (iter painter (- n 1))))

(pos1 painter (pos2 smaller smaller)))))

(iter m)))

(define right-split (split beside below))

(define up-split (split below beside))

Subscribe to:
Post Comments (Atom)

## No comments:

Post a Comment