mirror of
https://github.com/correl/sicp.git
synced 2024-11-23 11:09:57 +00:00
Ex. 1.32: sum and product using accumulate-iter
This commit is contained in:
parent
f5cfef579b
commit
26d06cd99f
1 changed files with 6 additions and 0 deletions
6
1-3.org
6
1-3.org
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue