Is there a good way to get the value of a key that is the most deeply nested in a map? The map could have any level of nesting.
So if I have {:a {:a 1 :b {:c 2 :d {:a {:e 4}}}}}
I want {:e 4}
but am having trouble getting there. Thanks
you can use recursion.
(def GET-E [(s/recursive-path [] p
(s/if-path map?
(s/if-path (s/must :e) (s/continue-then-stay [s/MAP-VALS p]) [s/MAP-VALS p]) s/STOP)) (s/submap [:e])])
(s/select GET-E {:a {:a 1 :b {:c 2 :d {:a {:e 4 :l 5}}}}})
=> [{:e 4}]