Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Last active May 27, 2017 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deque-blog/40cdb69beaeac5eadc34925fd7c590c6 to your computer and use it in GitHub Desktop.
Save deque-blog/40cdb69beaeac5eadc34925fd7c590c6 to your computer and use it in GitHub Desktop.
(defn fibo-trampoline
[^long n]
(letfn [(fibs [curr next ^long n]
(if-not (zero? n)
#(fibs next (+ curr next) (dec n))
curr))]
(trampoline (fibs 0N 1N n))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment