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

Recursion is stupid and wasteful

Name: Anonymous 2013-05-23 4:36

There is nothing that recursion can do that can't be done simpler and more elegantly with a plain for loop.

Name: Anonymous 2013-05-27 15:32

>>1
(defmemo fast-fib (x) (if (< x 2) x (+ (fib (- x 2)) (fib (- x 1)))))

;; definition of defmemo cut out for simplicity (though it isn't hard to write)

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