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-26 3:47

>>44
Except that what you said was the point. LISP fanboys make it seem as though LISP is this ultra powerful language that can use recursion to elegantly provide solutions when in reality, it can be done in C, and often better.

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