Hi Steve, thanks for your answer!
Am 19.10.2008 um 17:13 schrieb Stephen C. Gilardi: > 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! To be honest, i can't take much credit for it, about every Haskell tutorial starts with that definition. ;) But it's often stated that Clojure's model of lazy evaluation differs from Haskell, so i thought there was a reason for using step functions. If you'd really like to include it, please do (i already sent the CA). But - if i understand this correctly - there is this problem with root- bound lazy seqs: they won't ever get garbage collected. This might oder might not be what you want. Example 4 in the wiki adresses this problem, thus might be a better fit for a library, because the decision whether to root-bind oder lexically restrict the sequence is up to the user. Kind regards, achim -- http://rauschabstand.twoday.net --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---