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 that the :req and :req-un are exclusive specs as 
illustrated below:

(ns my.ns
  (:require [clojure.spec :as s]))

(s/def ::some-number int?)
(s/def ::map-with-numbers1 (s/keys :req [::some-number]))
(s/valid? ::map-with-numbers1 {::some-number 3}) => true
(s/valid? ::map-with-numbers1 {:some-number 3}) => false

(s/def ::map-with-numbers2 (s/keys :req-un [::some-number]))
(s/valid? ::map-with-numbers2 {::some-number 3}) => false
(s/valid? ::map-with-numbers2 {:some-number 3}) => true

In other words, would there a convenient way to specify a spec that would 
work for both qualified/unqualified keys at the same time?
;;Want a spec that validates as follows
(s/valid? ::map-with-numbers {::some-number 3}) => true
(s/valid? ::map-with-numbers {:some-number 3}) => true

Regards,

Ikuru

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to