Skip to content

Instantly share code, notes, and snippets.

@LauJensen
Forked from richhickey/gist:440102
Created June 17, 2010 12:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LauJensen/442044 to your computer and use it in GitHub Desktop.
Save LauJensen/442044 to your computer and use it in GitHub Desktop.
;new num branch results
(defn fib [n]
(if (>= 1 n)
1
(+ (fib (dec n)) (fib (- n 2)))))
(time (fib 38))
"Elapsed time: 3716.828 msecs"
;note, no change to body
(defn ^:static fib ^long [^long n]
(if (>= 1 n)
1
(+ (fib (dec n)) (fib (- n 2)))))
(time (fib 38))
"Elapsed time: 380.448 msecs"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment