Skip to content

Instantly share code, notes, and snippets.

@awostenberg
Created March 31, 2012 17:37
Show Gist options
  • Save awostenberg/2267009 to your computer and use it in GitHub Desktop.
Save awostenberg/2267009 to your computer and use it in GitHub Desktop.
Lazy infinite Fibonacci sequence in Clojure
(def fib-seq (lazy-cat [0 1]
(map + fib-seq (rest fib-seq))))
@awostenberg
Copy link
Author

To try it: paste the gist over to www.tryclj.com, and evaluate (take 15 fib-seq)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment