Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zipper instances with helpers #11

Open
moradology opened this issue Aug 24, 2017 · 0 comments
Open

Zipper instances with helpers #11

moradology opened this issue Aug 24, 2017 · 0 comments

Comments

@moradology
Copy link
Contributor

moradology commented Aug 24, 2017

Zippers are a functional construct for looking at trees without losing sight of their context. Simple recursion (which loses context that isn't explicitly passed into the tail call) likely isn't sufficient for everything people want to do and the creation of IDs requires being sensitive to a node's location within the tree (which, again, zippers are good at).

https://en.wikipedia.org/wiki/Zipper_(data_structure)

"Almost every programmer has faced the problem of representing a tree together with a
subtree that is the focus of attention, where that focus may move left, right, up, or down
the tree. The Zipper is Huet’s nifty name for a nifty data structure which fulfills this need.
I wish I had known of it when I faced this task, because the solution I came up with was
not quite so efficient or elegant as the Zipper."
http://gallium.inria.fr/~huet/PUBLIC/zip.pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant