Skip to content

Instantly share code, notes, and snippets.

@thiagofm
Created October 9, 2012 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thiagofm/3861673 to your computer and use it in GitHub Desktop.
Save thiagofm/3861673 to your computer and use it in GitHub Desktop.
fib clojure
(defn fib-list
[actual-n next-n iterations-left full-list]
(if
(not= iterations-left 0)
(fib-list (reduce + [actual-n next-n]) actual-n (- iterations-left 1) (conj full-list (reduce + [actual-n next-n]) ))
full-list
)
)
(defn -main
[& args]
(println (fib-list 0 1 10 [0]))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment