【发布时间】:2017-11-01 19:38:05
【问题描述】:
在尝试使用规范库时,我在尝试使用 exercise-fn 时遇到了错误。我已将其简化为the main guide page 上发布的示例,没有任何变化。
相关代码:
(ns spec1
(:require [clojure.spec.alpha :as s]))
;;this and the fdef are literal copies from the example page
(defn adder [x] #(+ x %))
(s/fdef adder
:args (s/cat :x number?)
:ret (s/fspec :args (s/cat :y number?)
:ret number?)
:fn #(= (-> % :args :x) ((:ret %) 0)))
现在,输入以下内容
(s/exercise-fn adder)
给出错误:
Exception No :args spec found, can't generate clojure.spec.alpha/exercise-fn (alpha.clj:1833)
使用的依赖项/版本,[org.clojure/clojure "1.9.0-beta3"] [org.clojure/tools.logging “0.4.0”] [org.clojure/test.check "0.9.0"]
任何人对为什么这会破坏有任何想法吗?谢谢。
【问题讨论】:
标签: clojure clojure.spec