Fri Mar 27 12:16:42 CET 2009


Using lazy lists as in the previous example only allows the
consumption of a data structure.  How can we use this to update/create
new trees?

Starting from a map function instead of a for-each functions, we
create the zipper data structure.


(define-struct zipper (element yield))

(define (collection->zipper map collection)
   (map (lambda (el)
          (shift k (make-zipper el k)))

So, is it fair to say a zipper is a symmetric (bi-directional)
coroutine and a lazy list an assymetric (uni-directional) coroutine?

At the traversal side, the other side is represented by the mapped
procedure, while on the zipper side the iterator is represented by the
delimited continuation.