"Alex Osborne" <a...@meshy.org> writes:

> (-> (map-zip {:foo {:bar {:baz 2}}})
>     zip/down
>     zip/down
>     (zip/insert-right [:greeting "Hello!"])
>     zip/down
>     (zip/edit (val-editor inc))
>     zip/root)
>
> ;; => [:root {:foo {:greeting "Hello!", :bar {:baz 3}}}]

I should also probably point out that the get-in/assoc-in/update-in
family of functions is a much better way of working with nested maps
than a zipper:

(-> {:foo {:bar {:baz 1}}}
    (assoc-in [:foo :bar :greeting] "hello!")
    (update-in [:foo :bar :baz] inc))

;; => {:foo {:bar {:greeting "hello!", :baz 2}}}

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to