News for hackers. Stuff that matters.
Re:Once you go functional, you can never go back by nanny on Monday May 18, 2015 @09:38AM (#9564308)
Seriously: Scheme is guaranteed to have tail-call replacement, the author should really take advantage of that.

Here's one that does:

    (define (fib-tco n)
      (let loop ((x 0)
                 (y 1)
                 (num n))
        (if (zero? n)
            x
            (loop y (+ x y) (- num 1)))))
Try getting the 1000th Fibonacci number which each of these.

Also, what's with the dangling parentheses?

There are no comments on this comment yet.