• 【SICP练习】79 练习2.51


            练习2.51

    通过书中前面的内容,我们知道below中来将框架分成上下两部分,而beside将框架分成左右两部分。因此,below定义如下:

    (define (below painter1 painter2)

      (let ((split-point (make-vect 0.0 0.5)))

         (let ((paint-top (transform-painter painter2

                                          split-point

                                          (make-vect 1.0 0.5)

                                          (make-vect 0.0 1.0)))

              (paint-down (transform-painterpainter1

                                            (make-vect 0.0 0.0)

                                            (make-vect 1.0 0.0)

                                            split-point)))

           (lambda (frame)

                (paint-top frame)

                (paint-down frame)))))

    另一种利用上一题中的rotate270等可以很容易的实现:

    (define (below painter1 painter2)

         (lambda (frame)

             ((flip-horiz

                  (rotate90

                      (beside

                          (rotate270

                             (flip-horizpainter1))

                          (rotate270

                             (flip-horizpainter2)))))

               frame)))

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

  • 相关阅读:
    阿里云Ubuntu环境搭建Docker服务
    Cocos2d-x手机游戏开发中-组合动作
    Java中将时间戳转化为Date类型
    Ubuntu14.04+eclipse下cocos2d-x3.0正式版环境的搭建
    hdu 4901 The Romantic Hero(dp)
    scikit-learn:3.4. Model persistence
    桥接模式和NAT模式差别
    JavaScript入门:004—JS凝视的写法和基本运算符
    MySQL 创建用户 与 授权
    【观点见解】解读大数据的5个误区
  • 原文地址:https://www.cnblogs.com/NoMasp/p/4786140.html
Copyright © 2020-2023  润新知