Created
June 27, 2016 20:54
-
-
Save melklein/58d7f139670f696a562dd404c21a6ea3 to your computer and use it in GitHub Desktop.
clojure recursion with loop and fibonacci numbers
This file contains hidden or 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
(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