I just spent hours trying to figure this out and even searching for the previous questions but the solutions don't seem to apply so I decided to create a new one.
I have an existing map with certain keys and values that I want to replace with values from another map.
(def m '{a {:*x 0 :*velx 1, :*vely 1}})
(def m' '{a {:*velx 9, :*vely 9}})
(assoc (m 'a) (m' 'a))
;; => {a {:*x 0 :*velx 9, :*vely 9}}
Since assoc
needs to take in the content of the map, this doesn't seem to work and I don't know how to 'remove the curly brakets' from it...
Edit: this is different to the suggested existing thread as it's not a list of maps but rather two separate maps and the proposed solution doesn't work in my case.
I managed to find it finally!
(merge-with into m m')
=> {a {:*x 0, :*velx 9, :*vely 9}}