Last active
August 29, 2015 14:12
-
-
Save RussellAndrewEdson/6a95f37005a26fead102 to your computer and use it in GitHub Desktop.
Clojure code to generate the nth Fibonacci number recursively.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn fibonacci | |
"Returns the nth Fibonacci number using a recursive process." | |
[n] | |
(cond (= n 0) 0 | |
(= n 1) 1 | |
:else (+ (fibonacci (- n 1)) | |
(fibonacci (- n 2))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment