-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
improvement: track supertree
, and add Zipper.all_the_way_up/1
#148
Conversation
lib/sourceror/zipper.ex
Outdated
@doc """ | ||
Walks the `zipper` all the way up, breaking out of any subtrees and returns the top-most `zipper`. | ||
""" | ||
@spec all_the_way_up(t) :: t | ||
def all_the_way_up(%Z{supertree: supertree} = zipper) when not is_nil(supertree) do | ||
all_the_way_up(into(top(zipper), supertree)) | ||
end | ||
|
||
def all_the_way_up(zipper), do: top(zipper) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can call this topmost
? It feels a bit more consistent with the names rightmost
and leftmost
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like topmost
👍
Should we also include |
Happy to add |
I don't really think that
all_the_way_up/1
is a great name, and I had to resist the urge to call itZipper.tippy_top/1
😂Open to suggestions.