Skip to content

Instantly share code, notes, and snippets.

@abatilo
Created January 28, 2018 15:42
Show Gist options
  • Save abatilo/c403412bc2b6a3549d58f4465ab6d2ef to your computer and use it in GitHub Desktop.
Save abatilo/c403412bc2b6a3549d58f4465ab6d2ef to your computer and use it in GitHub Desktop.
Clojure fibonacci
(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