Skip to content

Instantly share code, notes, and snippets.

@scottlowe
Created July 16, 2011 23:13
Show Gist options
  • Save scottlowe/1086906 to your computer and use it in GitHub Desktop.
Save scottlowe/1086906 to your computer and use it in GitHub Desktop.
Clojure function which returns the first X fibonacci numbers
(defn fib [max]
(loop [a 1, b 1, acc [1]]
(if (>= (count acc) max)
acc
(recur b (+ a b) (conj acc b)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment