(index ("fibonacci" 0))
(def (sig (procedure "(fibonacci n) → number" (id fibonacci))) (p "Computes the nth " (link "http://en.wikipedia.org/wiki/Fibonacci_number" "Fibonacci number") ".") (p "This naïve algorithm runs in " (i "O(2^n)") "; using e.g. memoization, we could bring it down to " (i "O(n)") ".") (dl (dt (tt "n")) (dd "The nth number to calculate")) (highlight scheme "(define (fibonacci n)\n  (case n ((0) 0) ((1) 1) (else (+ (fibonacci (- n 1)) (fibonacci (- n 2))))))"))
