Thanks Alex!  I like the approach of using get-in/assoc-in/update-in
much better than using a zipper.  I'll go read the api documentation
on those...

Thanks again.


On Dec 12, 4:36 pm, "Alex Osborne" <a...@meshy.org> wrote:
> "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