Update (Aug 8, 2017): I found another solution, outlined
here! Not necessarily exciting, but another way, nonetheless!
I came across a scenario where I needed to add a nested clojure map into an
existing map; something like:
Original:
Suppose I wanted to add an actor, and a language for the film? So in the end,
I’d like something like this:
Desired:
Here’s my solution:
First, define the original map to make it easier:
Insert :actor:
Similarly, :language can be added in the same way:
But what if I want to add both? My current strategy is to wrap one assoc-in
inside of another, using the result of the inner as the map for the outer:
Voila!! I get the result I’m after! I’m must admit, however, that this does not
feel like an elegant solution. I’ll keep digging to refactor this, and post
a better solution once I find it!