【SICP练习】80 练习2.52



练习2.52

在这道题上面的文字中就说到了用segments->painter提供线段表,这里的a小题的代码如下:

(segments->painter (list(make-segment (make-vect 0.0 0.0)

                                      (make-vect 1.0 1.0))

                       (make-segment ......)))

b小题代码如下:

(define (corner-split painter n)

   (if (= n 0)

      painter

      (let ((up (up-split painter (- n 1)))

           (right (right-split painter (- n1)))

            (corner (corner-split painter (- n1))))

        (beside (below painter up)

                (below right corner)))))

c小题代码如下:

(define (square-limit painter n)

  (let ((combine4 (square-of-four identity flip-horiz)

                      flip-vect rotate180))

        (combine4 (corner-split painter n))))

版权声明:本文为 NoMasp柯于旺 原创文章,如需转载请联系本人。

posted @ 2015-02-22 14:06  nomasp  阅读(119)  评论(0编辑  收藏  举报