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-10 11:55

>>9
I can't believe the amount of failure I'm seeing in your post.

- You don't understand Scheme. Your program doesn't do anything like the OP's one.
- You don't understand Hungarian notation. No, it's not about prefixing types to variable names. Seriously.
- You don't understand C. That has already been pointed out.
- You don't understand text editors. We don't need to count parentheses.

Still, you're trying to be all cocky at someone obviously better than you. Good job!

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