14 lines
281 B
Plaintext
14 lines
281 B
Plaintext
|
(define (sum term a next b)
|
||
|
(if (> a b)
|
||
|
0
|
||
|
(+ (term a)
|
||
|
(sum term (next a) next b))))
|
||
|
|
||
|
(define (sum-iter term a next b)
|
||
|
(define (iter a result)
|
||
|
(if (> a b)
|
||
|
result
|
||
|
(iter (next a) (+ result (term a)))))
|
||
|
(iter a 0))
|
||
|
|