clojure prewalk with select-keys -


(clojure.walk/prewalk #(if (map? %)                            (select-keys  % [:c])                             %)                       {:a 1 :b [{:c 3} {:d 4}] :c 5}) =>{:c 5} 

why find {:c 5} , not {:c 3}? i'm trying write pull out key/value pairs exist form , @ level key specify.

when function called with

{:c 5, :b [{:c 3} {:d 4}], :a 1} 

...it returns:

{:c 5} 

...thus discarding other keys, including :b branch, not traversed.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -