zoukankan      html  css  js  c++  java
  • 【SICP练习】88 练习2.60

    练习2.60

    这里的adjoin-set通过遍历后使用cons将表进行不断的组合,并在组合的过程中将x加到集合中去。

    (define (adjoin-set x set)
      (if (null? set)
           (list x)
           (let ((current-element (car set))
                (remain-element (cdr set)))
        (cond ((= x current-element)
                    set)
                  ((> x current-element)
                    (cons current-element
                          (adjoin-set x remain-set)))
                   ((< x current-element)
                     (cons x set))))))



    感谢访问,希望对您有所帮助。 欢迎关注或收藏、评论或点赞。


    为使本文得到斧正和提问,转载请注明出处:
    http://blog.csdn.net/nomasp


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

  • 相关阅读:
    订餐系统
    throw和throws
    CF999E Solution
    CF1142B Solution
    CF965C Solution
    CF963B Solution
    CF999F Solution
    CF975D Solution
    CF997B Solution
    hdu 2553 N皇后
  • 原文地址:https://www.cnblogs.com/NoMasp/p/4786131.html
Copyright © 2011-2022 走看看