title: Lazy infinite sequences in Clojure and Python
body: <p>Here are the best implementations I could find for lazy infinite sequences of Fibonacci numbers in both Clojure and Python:</p>
  
  <p>Clojure:</p>
  
  <pre><code>(def fib-seq (lazy-cat [0 1]
   (map + fib-seq (rest fib-seq))))
  </code></pre>
  
  <p>sample usage:</p>
  
  <pre><code> (take 5 fib-seq)
  </code></pre>
  
  <p>Python:</p>
  
  <pre><code>def fib():
   a = b = 1
   while True:
    yield a
    a,b = b,a+b
  </code></pre>
  
  <p>sample usage:</p>
  
  <pre><code>for i in fib():
    if i &gt; 100:
      break
    else:
      print i
  </code></pre>
  
  <p>Obviously the Python code is much more intuitive.</p>
  
  <p>My question is: Is there a better (more intuitive and simple) implementation in Clojure ?</p>
  
  <h1> Edit </h1>
  
  <p>I'm opening a follow up question at
  <a href="https://stackoverflow.com/questions/1590716/clojure-prime-numbers-lazy-sequence">Clojure Prime Numbers</a></p>