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

Rate my fibonacci program

Name: Anonymous 2013-08-27 8:08

(define (fib n)
  (((lambda (x) (x x))
    (lambda (fhelp)
      (lambda (remaining cpair)
        (if (zero? remaining)
          (cdr cpair)
          ((fhelp fhelp) (sub1 remaining) (cons (cdr cpair) (+ (car cpair) (cdr cpair))))))))
      n (cons 0 1)))

Name: Anonymous 2013-08-27 9:10

>>4
There a problem with the given level of nesting? It's using the Y-Combinator to achieve anonymous recursion. I don't think I could use any less nesting here without abandoning that.

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