specter

richiardiandrea 2023-11-17T20:21:21.321759Z

Hi there, I was checking this document https://github.com/nathanmarz/specter-wiki/blob/master/Using-Specter-Recursively.md#find-the-index-route-of-a-value-within-a-data-structure As I need to "navigate" to all the ancestors of a given tree branch (I have the full path to a leaf). I was thinking I could just collect all the values related to a node and then check to "keep it" or not when I react a leaf. Does that sound something doable in with specter?

nathanmarz 2023-11-18T22:31:43.138039Z

With a classic tree structure (e.g. nested vectors) you would need to use zippers to navigate from a child to its parent.

nathanmarz 2023-11-18T22:32:13.807899Z

This page documents zipper navigators https://github.com/redplanetlabs/specter/wiki/Using-Specter-With-Zippers

❤️ 1
richiardiandrea 2023-11-20T16:12:32.299789Z

Thank you Nathan for both answers

richiardiandrea 2023-11-17T20:51:22.589089Z

Ok simpler question, is there a way to navigate to the rest of a sequence? I basically want to skip the first element of my tree branch ("foo" ("bar") ("baz"))

nathanmarz 2023-11-18T22:30:32.833819Z

You can do this with srange-dynamic

❤️ 1