add setval convenience function to api

This commit is contained in:
Nathan Marz 2015-04-01 18:00:22 -04:00
parent 7e192a81f0
commit 7613ffd74e

View file

@ -55,6 +55,8 @@
(apply update-fn (conj vals structure))) (apply update-fn (conj vals structure)))
)))) ))))
(defn setval [selector val structure]
(update selector (fn [_] val) structure))
(defn replace-in [selector update-fn structure & {:keys [merge-fn] :or {merge-fn concat}}] (defn replace-in [selector update-fn structure & {:keys [merge-fn] :or {merge-fn concat}}]
"Returns [new structure [<user-ret> <user-ret>...]" "Returns [new structure [<user-ret> <user-ret>...]"