Ex. 1.32: sum and product using accumulate-iter

This commit is contained in:
Correl Roush 2014-06-10 20:00:19 -04:00
parent f5cfef579b
commit 26d06cd99f

View file

@ -197,6 +197,12 @@ layout: org
result result
(iter (next a) (combiner (term a) result)))) (iter (next a) (combiner (term a) result))))
(iter a null-value)) (iter a null-value))
(define (sum term a next b)
(accumulate-iter + 0 term a next b))
(define (product term a next b)
(accumulate-iter * 1 term a next b))
#+END_SRC #+END_SRC
** Exercise 1.33 ** Exercise 1.33