... is not some new form of dance music from the UK, but what appears  
to be a recurring - dare i say - pattern in the definition of lazy  
sequences: the combination of lazy-consing and a step function. There  
are plenty of these in boot.clj and in contrib's lazy-seq.clj.

Here's an example (poor Fibonacci again): 
http://en.wikibooks.org/wiki/Clojure_Programming#Lazy_Fibonacci
Why is any of the first three definitions preferable to a  
straightforward one like that?:

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

The last example i do understand: you can't define lexically scoped  
recursive lazy seqs like this (short of letrec), which you need if a  
function is supposed to construct a lazy seq internally. But i'm  
afraid there might be further subtleties i fail to see.

Can somebody explain this to a lazy-eval-newbie?

Thanks a lot!

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
-~----------~----~----~----~------~----~------~--~---

Reply via email to