Fork me on GitHub
#clojure-spec
<
2021-07-12
>
Ian Fernandez13:07:28

how can I select-keys giving a spec that has required keys?

Ian Fernandez13:07:52

I only want to pick the keys in a map that has in this spec

vlaaad13:07:42

Are you trying to write at function that, given a spec, will return a function that, given a map will strip all keys not mentioned in spec?

šŸ‘ 2
vlaaad13:07:10

Iā€™d suggest looking at s/form to get a form of a spec that mentions those keys

clojure-spin 2
Ian Fernandez13:07:30

(s/def ::my-one (s/keys :req [::a ::b]))

Ian Fernandez13:07:08

how can I make a ::my-two that has ::my-one keys and a key ::c too?