[<<][plt][>>][..]
Fri Mar 27 12:16:42 CET 2009

Zipper

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.

http://okmij.org/ftp/Scheme/zipper-in-scheme.txt

(define-struct zipper (element yield))

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

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.



[Reply][About]
[<<][plt][>>][..]