Can someone help explain to me how walker works. Below I'm trying to exclude all maps and submaps that contain a value "red"
(defn has-red? [x]
(prn x)
(cond (map? x) (nil? ((-> x vals set) "red"))
:else false))
(let [j [{"a" 2
"b" 4
"d" "green"
"e" [{"z" "zzz"
"y" "yyy"}]
"c" {"d" 5
"e" "red"
"g" {"h" 9
"i" \a}}
"m" {"aa" 99}}
{"sdfsdf" "gsdgdfgdfg"
"fsf" 979
"d" "orange"
"e" [{"z" "red"
"y" "yyy"}
{"jfoj" "purple"
"fffj" 5}]
"c" {"d" 5
"e" "purple"
"g" {"h" 9
"i" \a}}
"m" {"red" 99}}]]
(select (walker has-red?) j))
If I change has-red? to just return false. I get an empty vector, this makes sense, it also prints every key and value in the structure. If I just return true, then it prints the whole structure once and returns that....
Can I walk each element, and only returns those that has-red returns false for, that way dropping any sub maps that contain a value "red" ? What function should I be looking at ?