Reputation: 14197
Trying to make a piece of code better looking.
I have the following in Clojurescript:
(swap! app-state assoc-in [:lastresults] [])
(swap! app-state assoc-in [:error] false)
(swap! app-state assoc-in [:computing] true)
Sometimes more. Any idea on how to turn this in a cleaner multi-assignment.
I am looking at something like:
(swap! app-state assoc-in
[:lastresults] []
[:error] false
[:computing] true)
Upvotes: 3
Views: 844
Reputation: 13069
You don't need assoc-in
for just one level. This would work for your example:
(swap! app-state assoc
:lastresults []
:error false
:computing true)
Upvotes: 7