SICP 2.45
↓letの位置を前の方に持ってきたら再帰呼び出しのネストが深すぎるって怒られた。何でだろう?
(define (split f1 f2) (let ((smaller ((split f1 f2) painter (- n 1)))) (lambda (painter n) (if (= n 0) painter (f1 painter (f2 smaller smaller))))))
これなら大丈夫。
(load "../psets/go.scm") (define (split f1 f2) (lambda (painter n) (if (= n 0) painter (let ((smaller ((split f1 f2) painter (- n 1)))) (f1 painter (f2 smaller smaller)))))) (define right-split (split beside below)) (paint-g1 (right-split wave 4)) (define up-split (split below beside)) (paint-g1 (up-split wave 3))