Code Review

Compare your solutions

    (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 (accubulate combiner null-value term a next b)
;    (if (> a b)
;      null-value
;      (combiner (term a)
;         (product term (next a) next b))))

(define (sum a b) (accumulate + 0 identity a inc b))
(define (prod a b) (accumulate * 1 identity a inc b))
    ; (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 (accumulate combiner null-value term a next b)
   (if (> a b)
     null-value
     (combiner (term a)
        (accumulate combiner null-value term (next a) next b))))

(define (sum a b) (accumulate + 0 identity a inc b))
(define (prod a b) (accumulate * 1 identity a inc b))


    (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 (accubulate combiner null-value term a next b)
;    (if (> a b)
;      null-value
;      (combiner (term a)
;         (product term (next a) next b))))

(define (sum a b) (accumulate + 0 identity a inc b))
(define (prod a b) (accumulate * 1 identity a inc b))
    ; (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 (accumulate combiner null-value term a next b)
   (if (> a b)
     null-value
     (combiner (term a)
        (accumulate combiner null-value term (next a) next b))))

(define (sum a b) (accumulate + 0 identity a inc b))
(define (prod a b) (accumulate * 1 identity a inc b))