(defn string-to-string [s1]
{:pre [(string? s1)]
:post [(string? %)]}
s1)
I like :pre and :post conditions, they allow me to figure out wh
You could wrap your predicate with the is macro from clojure.test
(defn string-to-string [s1]
{:pre [(is (string? s1))]
:post [(is (string? %))]}
s1)
Then you get:
(string-to-string 10)
;FAIL in clojure.lang.PersistentList$EmptyList@1 (scratch.clj:5)
;expected: (string? s1)
;actual: (not (string? 10))