[racket] Functional zipper with multiple cursors?

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Wed Aug 24 16:17:22 EDT 2011

I'm trying to implement a functional interface to a tree.  One of the
standard things I can do is a zipper, which supports a single hole
where the "focus" lives.
(https://hkn.eecs.berkeley.edu/~dyoo/plt/zippers.txt)

However, as I understand it, zippers only support one "hole".  One of
the things I'd love to have is a zipper with multiple foci.  The
focused elements don't even necessarily have to be siblings.  I'm
trying to mimic the interface of a library like JQuery, which provides
a way to select a collection of nodes at once; it makes certain tree
manipulations really fun to do.

I've seen mention of it in:
http://stackoverflow.com/questions/3436559/zipper-like-data-structure-with-more-then-one-cursor,
with a reference to Oleg's "Zippers with Several Holes" code at
http://okmij.org/ftp/continuations/zipper.html#zipper2.  Has anyone
had experience implementing something like this?


Posted on the users mailing list.