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

improvement: track supertree, and add Zipper.all_the_way_up/1 #148

Merged
merged 7 commits into from
Jun 14, 2024

Conversation

zachdaniel
Copy link
Contributor

I don't really think that all_the_way_up/1 is a great name, and I had to resist the urge to call it Zipper.tippy_top/1 😂

Open to suggestions.

.tool-versions Outdated Show resolved Hide resolved
Comment on lines 93 to 101
@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)
Copy link
Owner

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like topmost 👍

@doorgan
Copy link
Owner

doorgan commented Jun 14, 2024

Should we also include topmost_root mimic root but that can be called from a subtree too?

@zachdaniel
Copy link
Contributor Author

Happy to add topmost_root as well :)

@doorgan doorgan merged commit 8b4b9c2 into doorgan:main Jun 14, 2024
6 checks passed
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

Successfully merging this pull request may close these issues.

2 participants