Fork me on GitHub
#clojure-spec
<
2021-04-15
>
alexmiller12:04:38

Are you talking about clojure.core/assert or s/assert? Seems like the latter would be good here

sam14:04:17

Thanks! Somehow I missed s/assert , I think you’re right. Maybe s/assert in a :pre condition…

alexmiller14:04:05

I'd put it in the mainline

alexmiller14:04:38

s/assert in mainline code is designed so that it can be compiled completely out of the program via https://clojure.github.io/spec.alpha/clojure.spec.alpha-api.html#clojure.spec.alpha/*compile-asserts*

sam15:04:49

Okay, thank you! I really appreciate the guidance.

Franco Gasperino22:04:28

Hello. Where i have several defined and registered predicates, can i compose them in this state?

;; contrived example
(s/def ::string-starts-with-an-a? (s/and string? #(string/starts-with? % "a")))
(s/def ::not-an-apple? #(not= "apple" %))
(s/def ::starts-with-an-a-but-not-an-apple? (s/and ::string-starts-with-an-a? ::not-an-apple?))

Franco Gasperino22:04:20

predicate composing after registration

Franco Gasperino22:04:37

disregard the above. my forms had not been evaluated, thus the error received was entirely my doing