Created
October 13, 2017 12:03
-
-
Save stuarthalloway/4d2215d5f7506104ea06ad727a608c43 to your computer and use it in GitHub Desktop.
Using clojure reset!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; fix for code shown at https://twitter.com/metcarob/status/918764898041188352 | |
(def recieved-slack-vars (atom {})) | |
;; unnecessarily complex | |
(defn return-second-arg [arg1 arg2] | |
arg2) | |
(defn set-recieved-slack-vars | |
[newval] | |
(swap! recieved-slack-vars return-second-arg newval)) | |
(set-recieved-slack-vars {:botname "Test"}) | |
;; fixed | |
(reset! recieved-slack-vars {:botname "Test"}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment