Skip to content

Instantly share code, notes, and snippets.

View dyba's full-sized avatar

M. Daniel Dyba dyba

View GitHub Profile
@dyba
dyba / gist:4197857
Created December 3, 2012 20:42 — forked from halgari/gist:4195378
Atom refactoring
(defn update-my-atom [a name]
(let [new-state (assoc-in @a [:foo :bar] (merge {:name name}))]
(swap! a (fn [old] new-state))))
;; refactored into:
(defn get-new-state [state name]
(assoc-in state [:foo :bar] (merge {:name name})))