2 ms·
Similar to the example of the OP: (def walrus (agent {})) ; good (defn frobnicate [w] (assoc w :frobnicated true)) (send walrus frobnicate) ; b
by bcrosby95 3y ago
Similar to the example of the OP:
(def walrus (agent {}))
; good
(defn frobnicate [w]
(assoc w :frobnicated true))
(send walrus frobnicate)
; bad
(defn frobnicate [w]
(send walrus #(assoc % :frobnicated true)))
(frobnicate walrus)
It might make sense to also have a function that executes something like (send walrus frobnicate). But IMHO code should basically never look like the bad example.