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

zippers/focus/lenses #17

Open
tarakc02 opened this issue Dec 4, 2022 · 0 comments
Open

zippers/focus/lenses #17

tarakc02 opened this issue Dec 4, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@tarakc02
Copy link
Owner

tarakc02 commented Dec 4, 2022

Some references:

Based on my current understanding, the iterators over RandomAccess.Digit and RedBlack.Tree are already basically zippers (developed by accident). They appear composable, so implementing a zipper-like structure on linked lists and a couple of other types should provide all that's needed for zippers over tries and random access lists. The immediate benefit would be the ability to optimize update_at, which increments the value associated with a given key -- currently that requires traversing the input twice, once to find the key and current value and then again to place the updated value into the right spot. Longer term, zippers or something like them seem like a functional analogue to mutable iterators, so they might allow exploration of sorting and other algorithms that can make use of mutable iterators.

@tarakc02 tarakc02 added the enhancement New feature or request label Dec 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant