clojure filter nested map to return keys based on inner map values
问题 For this nested map called "tables", (def tables {:tableA {:occupied false :party nil} :tableB {:occupied true :party nil} :tableC {:occupied false :party nil}}) how do I filter and get back the keys where :occupied = false ? correct result should be (:tableA :tableC) can I do this with "filter" HOF? Should I be using a list comprehension? 回答1: You could do it pretty easily with keep : (keep (fn [[k v]] (if-not (:occupied v) k)) tables) However, as you observed, using for is often a good