Last active
June 27, 2016 20:54
-
-
Save melklein/9bc192874dc3b8995a7a826d3dca935f to your computer and use it in GitHub Desktop.
recursion in clojure with fibonacci numbers
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 fib-anon [mx] | |
((fn [x result] | |
(if (= x 0) | |
(reverse result) | |
((let [next-fib (reduce + (take 2 result))] | |
recur (dec x) next-fib)))) | |
(- mx 2) '(1 1))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
first version