Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

[SICP] Ex 1.30 / 1.31

Name: Anonymous 2008-02-10 7:46

Here's what I have

; Ex 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))
; Ex 1.31
(define (product term a next b)
  (define (iter a result)
    (if (> a b)
        result
        (iter (next a) (* result (term a)))))
  (iter a 1))

(define (fac n)
  (product (lambda (x) x) 1 (lambda (x) (+ x 1)) n))


Am i rite?

Name: Anonymous 2008-02-11 9:20

>>21
YHBT again.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List