Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

OpenPath #5

Open
janwirth opened this issue Aug 30, 2019 · 1 comment
Open

OpenPath #5

janwirth opened this issue Aug 30, 2019 · 1 comment

Comments

@janwirth
Copy link

The layz-tree-with-zipper library has openPath https://package.elm-lang.org/packages/turboMaCk/lazy-tree-with-zipper/latest/Lazy-Tree-Zipper#openPath

Do you think this would make sense for canopy as well? I can imagine a targeted depth-first search would be more efficient than an untargeted one or a breadth-first search.

@janwirth
Copy link
Author

janwirth commented Aug 30, 2019

A stub implementation would be

findCurrent path tree =
    case List.reverse path of
        id :: _ -> Canopy.seek (\el -> el.id == id) tree
        _ -> Nothing

But this is not as performant as it could be.

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

No branches or pull requests

1 participant