Solution to SICP Exercise 1.30

Structure and Interpretation of Computer Programs

Solution to Exercise 1.30:

(define (sum term a next b)
(define (iter a result)
(if (> a b)
result
(iter (next a) (+ result (term a)))))
(iter a 0))

Advertisements