Created
January 28, 2018 15:42
-
-
Save abatilo/c403412bc2b6a3549d58f4465ab6d2ef to your computer and use it in GitHub Desktop.
Clojure fibonacci
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
(ns flyr.core) | |
(defn fib [n] | |
(if (= 0 n) | |
0 | |
(if (= 1 n) | |
1 | |
(+ (fib (- n 1)) (fib (- n 2)))))) | |
(defn -main | |
"The document string" | |
[] | |
(-> | |
(loop [i 0] | |
(-> | |
(fib i) | |
(println)) | |
(if (< i 10) | |
(recur (+ i 1))))) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment