Skip to content

A function to move to top i.e. position [1,1] or a custom position in the zipper #149

Open
@mjayprateek

Description

Problem/Opportunity
At times we need to automate changes which requires us to repeatedly (inside code) search for values and make changes. Now while doing that operation on config.edn (or for any other type), after first search, once the zipper location is inside a deeply nested map, there's a problem in searching for brothers of current-location's grandfather or great-grandfather.

This is tough when you don't even know at what level (grandfather or great-grandfather or above that) is the next search item located.

Proposed Solution
There should be a method in zip API to either:

  1. a method to move the zipper to top so that I don't have to do that manually for the next search
  2. OR a method to move the zipper to a custom position, say [2, 13]. Though, I'm not sure how useful this would be
  3. OR a find function which lets you search from the beginning instead of the current location

Alternative Solutions
I've written my own function to go up continuously till a certain key is found. I begin my successive searches from there on.

Additional context
Let me know if you need some concrete examples.

Action
I'm happy to contribute a PR with whatever solution the maintainers agree on.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status

      Medium Priority

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions