clojure-spec

About: http://clojure.org/about/spec Guide: http://clojure.org/guides/spec API: https://clojure.github.io/spec.alpha/clojure.spec.alpha-api.html
oskarkv 2020-05-03T20:02:22.320700Z

I tried one of the examples on http://clojure.org, namely this one:

(defn adder [x] #(+ 1 x %))

(s/fdef adder
  :args (s/cat :x number?)
  :ret (s/fspec :args (s/cat :y number?)
                :ret number?)
  :fn #(= (-> % :args :x) ((:ret %) 0)))
And I did did
(st/instrument `adder)
If I pass in a string, I get a complaint. But as you can see, I added a 1 in the body of adder so that the :fn check wouldn't hold. But nothing happens when I call adder. What's going on?

alexmiller 2020-05-03T20:16:23.321Z

https://clojure.org/guides/faq#instrument_ret

oskarkv 2020-05-03T22:45:30.321500Z

Thanks!