Created
March 31, 2012 17:37
-
-
Save awostenberg/2267009 to your computer and use it in GitHub Desktop.
Lazy infinite Fibonacci sequence in Clojure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def fib-seq (lazy-cat [0 1] | |
(map + fib-seq (rest fib-seq)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To try it: paste the gist over to www.tryclj.com, and evaluate (take 15 fib-seq)