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

Elegant as fuck

Name: Anonymous 2011-05-15 20:42

def fib(times):
    a, b = 0,1
    for _ in range(times):
        a, b = b, a+b
    return a


I think I just creamed my pants.

Name: Anonymous 2011-05-16 22:47

>>36
too bad your fib is inaccurate as fuck.
(define fib           
  (let* ((√5 (inexact->exact (sqrt 5)))
         (φ (/ (add1 √5) 2)))
    (lambda (n)
      (/ (expt φ n) √5))))

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