On 22/09/17 23:19, Beau Fabry wrote:
> Not sure if I'm being glib here but #(s/valid? ::pm-hours %) returns a
> predicate that has the exact same results as #(s/int-in-range? 12 24 %)
Fair, but I was thinking specifically of those situations where you want
to bypass the spec registry, say where yo
Not sure if I'm being glib here but #(s/valid? ::pm-hours %) returns a
predicate that has the exact same results as #(s/int-in-range? 12 24 %)
On Friday, September 22, 2017 at 1:10:51 PM UTC-7, Didier wrote:
>
> I'd try to call describe on the spec. As far as I know that's the only
> introspecti
I'd try to call describe on the spec. As far as I know that's the only
introspection feature of spec. See if it returns what you need.
--
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
Is it possible to extract the predicate from a spec? Seeing the
predicate form is easy enough but how can I actually use it as a
predicate?
(s/def ::pm-hours #(s/int-in-range? 12 24 %))
(s/form ::pm-hours)
I did come up with the following construct, which does give me the
result I’m look