On Jan 18, 2:14 am, mac <markus.gustavs...@gmail.com> wrote:
> Updating stuff in the map became a little bit of a hassle so I made
> versions of assoc-in and update-in that work on dgraphs. Here they are
> in case anyone else is interested:
>
> (defn assoc-node
>   [dgraph m ks v]
>   (dgraph m (assoc-in (dgraph m) ks v)))
>
> (defn update-node
>   [dgraph m ks f & args]
>   (dgraph m (apply update-in (dgraph m) ks f args)))
>
> Suppose we have a dgraph dg and a map in the dgraph with the key :gui-
> data, in the map we want to replace or update the key :message
>
> (assoc-node dg :gui-data [:message] "Hello World!")
> (update-node dg :gui-data [:message] conj "World!")

Thanks, Markus! I added these functions into dgraph as assoc-in-node
and update-in-node. The new version of dgraph with these additions is
1.1.0, available on GitHub and Clojars.

http://github.com/gcv/dgraph
http://clojars.org/dgraph
-- 
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