Hi,

I've been playing around with the Zipper code, partly to enhance it but 
mostly at this point to become competent with Clojure programming.

One of the first things I tried to do was produce a pair of functions 
for doing both depth-first and breadth-first walks though a Zipper 
tree. I wrote these in such a way that the caller supplied a function 
that would be invoked at each node of the Zippered tree in the 
specified traversal order.

But when I started thinking about this for a bit, it occurred to me to 
wonder about whether a lazy sequence would be more appropriate. And in 
thinking about the contrast, one thing that then occurred to me was 
that with a lazy sequence approach, it's easy to bail out of a 
traversal. You just stop asking for more from the sequence. But with 
the "classic" inversion-of-control / callback approach, getting out 
early requires funky things like return values that indicate "stop" 
vs. "continue" or you're forced to use an exception.

So would it be valid to conclude that the old inversion-of-control / 
callback patterns are generally contraindicated in Clojure programming 
in favor of lazy sequences? And if, as I suspect is the case, the 
answer is "yes," then when, if ever, (in new code w/o Java 
encumbrances) would it be a good idea to go "old school"?


Randall Schulz

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