You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, regardless of the focus of a zipper, functions like Zipper.find/2 will continue to search nodes outside of the focus (depth-first pre-order). There are cases where it's useful to operate only within the bounds of the current focus, however.
For instance:
zipper|>Zipper.find(...)# find some parent node|>Zipper.find_within(...)# find some child within the parent node|>Zipper.update(...)# update the child somehow|>Zipper.root()# navigate back to the root of the entire AST
There are other functions in Zipper, like traverse, that would also benefit from a *_within variant.
The text was updated successfully, but these errors were encountered:
The traverse functions already operate on the subtree, so they do not need the *_within version.
Perhaps we could also simply introduce an within/2 function.
zipper|>Zipper.find(...)# find some parent node|>Zipper.within(fnz->Zipper.find(z,...))# find some child within the parent node|>Zipper.update(...)# update the child somehow|>Zipper.root()# navigate back to the root of the entire AST
Currently, regardless of the focus of a zipper, functions like
Zipper.find/2
will continue to search nodes outside of the focus (depth-first pre-order). There are cases where it's useful to operate only within the bounds of the current focus, however.For instance:
There are other functions in
Zipper
, liketraverse
, that would also benefit from a*_within
variant.The text was updated successfully, but these errors were encountered: