Iterative sum using recursion Given the following recursive definition of sum:


(define (sum term a next b)
  (if (&gt; a b)
      0
      (+ (term a)
         (sum term (next a) next b))))



And the task: 


  Exercise 1.30
  
  The sum procedure
  above generates a linear recursion.
  The procedure can be rewritten so that
  the sum is performed iteratively. Show
  how to do this by filling in the
  missing expressions in the following
  definition:

(define (sum term a next b)
  (define (iter a result)
    (if &lt;??&gt;
        &lt;??&gt;
        (iter &lt;??&gt; &lt;??&gt;)))
  (iter &lt;??&gt; &lt;??&gt;))



I wrote the following code.  What do you think?

(define (i-sum term a next b)
  (define (iter a result)
    (if (&gt; a b)
        result
        (iter (next a) (+ result (term a)))))
  (iter a 0))

(define (identity x) x)
(define (inc x) (+ 1 x))
(define (sum-integers a b) (i-sum identity a inc b))
I believe your answer is correct, although I'm not sure why you need the identity, inc, and sum-integers procedure on the bottom for your solution.