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 looking for, but I suspect there must be a way without
that defpred helper.
(defmacro defpred [name spec]
(list 'def name (s/form spec)))
(defpred pm-hours? ::pm-hours)
--
David
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.