이 문제는 앞에서 보았던 right-split와 up-split 프로시저보다 활용도가 높은
split 프로시저를 만드는 문제입니다.

split 프로시저를 만들고 각각에 적용시켜보니 잘 작동되는군요.^^
참조
해럴드 애빌슨, 김재우 역, <컴퓨터 프로그램의 구조와 해석>, 인사이트, 2007, pp. 173
; library
(require "paint/painters.ss")
; answer
(define (split small-combine combine)
(lambda (painter n)
(if (= n 0)
painter
(let ((smaller ((split small-combine combine) painter (- n 1))))
(combine painter (small-combine smaller smaller))))))
; new definition
(define right-split (split beside below))
(define up-split (split below beside))
; execute
(define Sungnyemun
(load-painter
(build-path "Sungnyemun.jpg")))
(paint Sungnyemun)
(paint (up-split Sungnyemun 3))
(paint (right-split Sungnyemun 3))
- SICP Exercise 연습문제 2.48 (0)2008/02/20
- SICP Exercise 연습문제 2.47 (0)2008/02/20
- SICP Exercise 연습문제 2.46 (0)2008/02/20
- SICP Exercise 연습문제 2.45 (0)2008/02/20
- SICP Exercise 연습문제 2.44 (0)2008/02/17
- SICP Exercise 연습문제 2.41 (0)2008/02/16
- SICP Exercise 연습문제 2.40 (0)2008/02/16
글에 잘못된 점, 다른 점, 부족한 점이 있다면 지적해주세요.
댓글, 트랙백, 메일 모두 고맙습니다.







댓글을 달아 주세요