Skip to content

Instantly share code, notes, and snippets.

@stuartwakefield
Last active December 24, 2015 15:09
Show Gist options
  • Save stuartwakefield/6817565 to your computer and use it in GitHub Desktop.
Save stuartwakefield/6817565 to your computer and use it in GitHub Desktop.
A method to create a Fibonnaci sequence
(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