Last active
December 24, 2015 15:09
-
-
Save stuartwakefield/6817565 to your computer and use it in GitHub Desktop.
A method to create a Fibonnaci sequence
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 fibseq [n] | |
((fn inner [acc m] | |
(if (= m 0) | |
acc | |
(inner (conj acc (+ | |
(if (< (count acc) 2) | |
0 (get acc (- n m 2))) | |
(if (< (count acc) 1) | |
1 (get acc (- n m 1))))) (- m 1)))) [ ] n)) | |
(println (fibseq 90)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment