In a project, I required + aliased clojure.alpha.spec
like this:
(ns example.core
(:require [clojure.alpha.spec :as spec]))
Then I tried to define a simple spec like
(spec/def ::example-spec #(not (neg? %)))
Compiling gave the error that namespace s
was undefined.
I believe this came down to a typo in clojure.alpha.spec/def
. In file spec-alpha2/src/main/clojure/clojure/alpha/spec.clj
, line 456, there is a backquoted s/spec
but the alias at the top of the file is to sa
. Here's line 456:
(#{'fn 'fn* `c/fn} op) `(s/spec ~explicated-form)
After changing the line to
(#{'fn 'fn* `c/fn} op) `(sa/spec ~explicated-form)
my spec/def
works successfully.