On Oct 19, 2008, at 8:49 AM, Achim Passen wrote:

>       (def fibs (lazy-cat [0 1] (map + fibs (rest fibs))))

That looks strictly better than the other examples to me. If you're  
willing and if you send a Contributer Agreement to Rich, I'd like to  
adopt it in clojure.contrib.lazy-seqs. In the meantime, the wiki is  
editable, I encourage you to put yours in it.

I'm trying to come up with a similarly simple powers-of-2... Ah,  
there's one:

        (def powers-of-2 (lazy-cons 1 (map #(bit-shift-left % 1) powers-of-2)))

or the equivalent

        (def powers-of-2 (lazy-cons 1 (map #(+ % %) powers-of-2)))

Very cool, thanks for pointing it out!

--Steve


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to