Fibonacci numbers in Lisp
Example for versions
Clojure 1.0.0,
Clojure 1.1.0
This example uses recursive definition of Fibonacci numbers.
(defn fibonacci [x]
(if (< x 2)
x
(+ (fibonacci (- x 1)) (fibonacci (- x 2)) )))
(doseq [i (range 1 17)]
(print (str (fibonacci i) ", ")))
(println "...")
Comments
]]>blog comments powered by Disqus
]]>