-
-
Save timmc/3861930 to your computer and use it in GitHub Desktop.
fib clojure 2
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 fib | |
([n] | |
(fib [0 1] (- n 2))) | |
([list-fib n] | |
(if (zero? n) | |
list-fib | |
(recur (conj list-fib (apply + (take-last 2 list-fib))) | |
(dec n))))) | |
(fib 10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment