Re: Is there an easy way for s/keys spec to work against both qualified/unqualiffied keys at the same time?

2016-10-17 Thread Mauricio Aldazosa
On Sun, Oct 16, 2016 at 11:40 PM, Ikuru Kanuma wrote: > Mauricio, thanks for the response! > I agree that that gets what I asked for done, but that solution is in > essence writing the same > qualified/unqualified version of the spec twice and sounded redundant, > which lead to my question. > I g

Re: Is there an easy way for s/keys spec to work against both qualified/unqualiffied keys at the same time?

2016-10-16 Thread Ikuru Kanuma
Mauricio, thanks for the response! I agree that that gets what I asked for done, but that solution is in essence writing the same qualified/unqualified version of the spec twice and sounded redundant, which lead to my question. I guess it is what it is in that case... Leon, thanks for the respo

Re: Is there an easy way for s/keys spec to work against both qualified/unqualiffied keys at the same time?

2016-10-14 Thread Leon Grapenthin
They are not exclusive (s/def ::baz (skeys :req [::foo] :req-un [::bar])) works. On Friday, October 14, 2016 at 7:07:39 AM UTC+2, Ikuru Kanuma wrote: > > Hi, > > I was reading the official spec guide's explanation for the s/keys macro, > played around with it a bit, > and was a little surprised

Re: Is there an easy way for s/keys spec to work against both qualified/unqualiffied keys at the same time?

2016-10-14 Thread Mauricio Aldazosa
Hi, You can achieve that using *spec/or*: (s/def ::map-with-numbers (s/or :qualified ::map-with-numbers1 :unqualified ::map-with-numbers2)) (s/valid? ::map-with-numbers {::some-number 3}) => true (s/valid? ::map-with-numbers {:some-number 3}) => true ​ Cheers, Mauricio -- You receive