Easy way to filter list of maps by values of keys in Clojure
<p>I cannot find build-in functionality in Clojure to filter list of maps by values of keys. For example we have a following list:</p>

<pre><code>user=&gt; (def animals (list {:name "Charlie" :weight 350 :specie :elephant}
                          {:name "Vasya" :weight 250 :specie :bear}
                          {:name "John" :weight 200 :specie :elephant}
                          {:name "Monk" :weight 200 :specie :monkey}))
#'user/animals
</code></pre>

<p>And I want to select, for example, all the <code>:specie</code> with value <code>:elephant</code>. How can I do that? The best way I found out is this:</p>

<pre><code>user=&gt; (defn filter-data [data m]
         (let [k (keys m) v (vals m)]
           (filter #(= (map % k) v) data)))
#'user/filter-data

user=&gt; (clojure.pprint/print-table (filter-data animals {:specie :elephant}))

|   :name | :weight |   :specie |
|---------+---------+-----------|
| Charlie |     350 | :elephant |
|    John |     200 | :elephant |
nil
</code></pre>

<p>Is there a better way to do that?</p>