Skip to content

Instantly share code, notes, and snippets.

@ponkore
Created March 26, 2012 14:21
Show Gist options
  • Save ponkore/2205429 to your computer and use it in GitHub Desktop.
Save ponkore/2205429 to your computer and use it in GitHub Desktop.
fibo.clj
;; 何のひねりもない fibo
(defn fibo [x]
(if (or (= 0 x) (= 1 x))
1
(+ (fibo (- x 1)) (fibo (- x 2)))))
;;
(map #(fibo %) (take 10 (iterate inc 1)))
;; => (1 2 3 5 8 13 21 34 55 89)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment