Re: Obtaining the predicate of a spec

2017-09-22 Thread David Bürgin
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

Re: Obtaining the predicate of a spec

2017-09-22 Thread Beau Fabry
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

Obtaining the predicate of a spec

2017-09-22 Thread Didier
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

Obtaining the predicate of a spec

2017-09-22 Thread David Bürgin
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