Find location of node in tree using Clojure zippers -


i have tree of unknown structure. first, want find node containing string of text, "something". then, after identifying string's location in tree, want update different node relative string's location. data nested map several branches of lists.

is possible zippers?

i've studied approach editing trees: http://www.exampler.com/blog/2010/09/01/editing-trees-in-clojure-with-clojurezip/. problem is, don't beforehand know location of string.

yes! kind of task zippers designed for.

  • repeatedly call zip/next until find node looking for.
  • then call zip/path find out relative root.
  • then call zip/up, zip/down, zip/left etc node modify.
  • update node
  • call zip/root new map containing these changes.

Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -