我想将assoc地图的值添加到atom.我可以这样做:
(defonce config (atom {}))
(swap! config assoc :a "Aaa")
(swap! config assoc :b "Bbb")
Run Code Online (Sandbox Code Playgroud)
但这是重复的,并拨打了几个电话swap!.我想做那样的事情:
(swap! config assoc {:a "Aaa"
:b "Bbb"})
;; this doesn't work :
;; Exception in thread "main" clojure.lang.ArityException: Wrong number of args (2) passed to: core$assoc
Run Code Online (Sandbox Code Playgroud)
我怎么做 ?