zoukankan      html  css  js  c++  java
  • 【SICP练习】52 练习2.20

    

    练习2.20

    如果读懂了题目的意思这道题也是不难的,重点就是带点尾部记法形式的define。下面我们就来写出same-parity过程。

    (define (same-parity fist . other)

       (filter (if (even? fist)

                    even?

                 odd?)

              (cons first other)))

    最巧妙地地方就在于用cons将散乱的firstother结合到一起,然后用filter来保留需要的部分,其中if返回的是谓词。

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

  • 相关阅读:
    border-radius
    border-style
    border-width
    border
    max-width
    min-width
    clip 语法
    left
    z-index
    position
  • 原文地址:https://www.cnblogs.com/NoMasp/p/4786167.html
Copyright © 2011-2022 走看看