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/ad8c6e8b7e212d8ed7e22d6776eb1a9b to your computer and use it in GitHub Desktop.
Save deque-blog/ad8c6e8b7e212d8ed7e22d6776eb1a9b to your computer and use it in GitHub Desktop.
(defn fibo-local-vars
[^long n]
(with-local-vars [curr 0N
next 1N
iter n]
(while (> @iter 0)
(let [nnext (+ @curr @next)]
(var-set curr @next)
(var-set next nnext)
(var-set iter (dec @iter))))
@curr))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment