Hi guys! I have two structures like:
(def index
{:foo {"key-1" {:include #{"value-1" "value-2"}}
"key-2" {:exclude #{"value-1"}}}})
(def partial-index
{:foo {"key-1" {:include #{"value-2"}}
"key-2" {:exclude #{"value-2"}}}})
My goal is to apply partial-index into index in order to have:
(def final-index
{:foo {"key-1" {:include #{"value-1" "value-2"}}
"key-2" {:exclude #{"value-1" "value-2"}}}}
value-2 is added into ["key-2" :exclude]
In order to do this I have imagine to get all the path from partial-index and apply them to index such as:
(def partial-index-path
[[:foo "key-1" :include (s/terminal set/union)]
[:foo "key-2" :exclude (s/terminal set/union]])
To get the partial-index-path I have from the moment:
(def REC
(s/recursive-path
[] p
(s/cond-path
map? [s/ALL (s/collect-one s/FIRST) p]
vector? [s/LAST p]
set? s/STAY)))
(def partial-index-path (s/select REC partial-index))
Did you see an other way to apply change from partial-index to index?nested merge-with is probably easier