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

Racket

Name: Anonymous 2012-09-25 13:28

there must be a better way to do this right


(define (factorial n)
    (define (iter n result)
        (if (= n 0)
            result
            (iter (- n 1) (* result n))))
    (iter n 1))

Name: Anonymous 2012-09-25 20:03

>>28
Are you saying some C compilers don't use the stack, or that its just not necessary?
As long as we're not talking of extant ones, sure. Otherwise that's not what I'm saying.

Where the fuck does it keep the thread environment?
Wherever it wants. It's implementation defined. You've already been given an example. Think up your own!

I suppose C itself isn't really reliant on the stack
Holy fuck. How many times have you been told this very thing just now?

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