Skip to content

Instantly share code, notes, and snippets.

@RussellAndrewEdson
Last active August 29, 2015 14:12
Show Gist options
  • Save RussellAndrewEdson/6a95f37005a26fead102 to your computer and use it in GitHub Desktop.
Save RussellAndrewEdson/6a95f37005a26fead102 to your computer and use it in GitHub Desktop.
Clojure code to generate the nth Fibonacci number recursively.
(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