4 ms·
this is a pretty hand wavy introduction to zippers. A Zipper is many cool things, but most importantly it can be thought of as a really nice way of supporting
by carterschonwald 16y ago
this is a pretty hand wavy introduction to zippers.
A Zipper is many cool things, but most importantly it can be thought of as a really nice way of supporting arbitrary traversals of tree-like data structures. On the theory side there are cool papers such as www.cs.nott.ac.uk/~ctm/diff.pdf which talk about some of the interesting relationships between zippers and certain types of recursive data structures.
Also, earlier this summer someone released a really wonderful generic zipper library for haskell https://www.cs.indiana.edu/~adamsmd/papers/scrap_your_zippers/ https://www.cs.indiana.edu/~adamsmd/papers/scrap_your_zipper... that is quite nice.
I've actually spent a few weeks this summer thinking very hard about how to add some cool functionality to the zipper abstraction layered on top of the scrap your zipper library.
Either way, if you're doing anything algorithmic on a tree that is more complicated than a left or right fold, if you're not using a zipper, you're probably making things overly difficult for you self. Save a programmer (week), use a zipper! :)
- raju 16y agoI was hoping to find some resources on the "zipper" - The article that you reference in your comment has cited this one - http://www.st.cs.uni-saarland.de/edu/seminare/2005/advanced-fp/docs/huet-zipper.pdf http://www.st.cs.uni-saarland.de/edu/seminare/2005/advanced-... [PDF Link] which seems pretty relevant too. Thanks for the pointer