1.32 (更高层次的抽象! 乘法与加法本来就是一回事)

Posted ...............洋葱的秋秋空间........

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了1.32 (更高层次的抽象! 乘法与加法本来就是一回事)相关的知识,希望对你有一定的参考价值。

(define (accumulate combiner null-value term a next b)
  (define (iter a result)
  (if (> a b)
      result
      (iter (next a)
            (combiner (term a) result))))
  (iter a null-value))

(define (sum term a next b)
  (accumulate +
              0
              term
              a
              next
              b))

(define (product term a next b)
  (accumulate *
              1
              term
              a
              next
              b))

(sum (lambda (x) x)
           1
           (lambda (i) (+ i 1))
           10)

  

以上是关于1.32 (更高层次的抽象! 乘法与加法本来就是一回事)的主要内容,如果未能解决你的问题,请参考以下文章

加法变乘法

高精度 加法 减法 乘法 除法 整合

深入理解Python列表(list)

sap的四则运算中的加法

大数加法与大数乘法(字符串形式输入输出)

当值加倍时,加法与乘法与左移操作[重复]