Advertisement
dredder_gun

search-some

Mar 19th, 2017
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (defn find-map-with-key-some [targetCollection targetKey targetValue]
  2.     (some
  3.       #(when (and (map? %) (contains? % targetKey) (= (get targetValue targetKey) targetValue)) %)
  4.       targetCollection))
  5.  
  6. (let [ex1 {:key1 "a" :key2 "b" :key3 {:underKey1 "a2" :underKey2 "b2"}}]
  7.   (find-map-with-key-some ex1 :underKey1 "a2"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement