Eg in a map:
{"test-1" 23,
 "test-2" 456,
 "test-3" 23}
How to find keys that have value 23?
I think you don't need specter to do that, just filter by value. I.e:
(->> {:key-1 10
      :key-2 20
      :key-3 10}
      (filter (fn [[k v]] (= v 10)))
      (map first))
==>  [:key-1 :key-3]
A solution with Specter is:
(keys (specter/setval [specter/MAP-VALS #(not= 10 %)]
                       specter/NONE
                       {:key-1 10
                        :key-2 20
                        :key-3 10}))
If you want to find something using Specter, it is better to use specter/select.
(use 'com.rpl.specter)    
(select [ALL #(= (second %) 23) FIRST]
  {"test-1" 23,
   "test-2" 456,
   "test-3" 23})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With