Skip to content

Instantly share code, notes, and snippets.

@melklein
Created June 27, 2016 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save melklein/58d7f139670f696a562dd404c21a6ea3 to your computer and use it in GitHub Desktop.
Save melklein/58d7f139670f696a562dd404c21a6ea3 to your computer and use it in GitHub Desktop.
clojure recursion with loop and fibonacci numbers
(fn [mx]
(loop [x (- mx 2) result '(1 1)]
(if (> x 0)
(recur (dec x)
(conj result
(reduce + (take 2 result))))
(reverse result)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment