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
Ronny Li 2020-11-12T20:39:55.353600Z

Hi, does anyone have advice for how to read the following error message from plumatic/schema? My understanding is that the arity doesn't conform to spec but where did the error occur? (`(demo/data.clj:77:1)` is simply where I defined the function)

Error refreshing environment: Syntax error macroexpanding clojure.core/defn at (demo/data.clj:77:1).
Call to clojure.core/defn did not conform to spec. clojure.lang.ExceptionInfo: Call to clojure.core/defn did not conform to spec. #:clojure.spec.alpha{:problems ({:path [:fn-tail :arity-1 :params], :pred clojure.core/vector?, :val :-, :via [:clojure.core.specs.alpha/defn-args :clojure.core.specs.alpha/params+body :clojure.core.specs.alpha/param-list :clojure.core.specs.alpha/param-list], :in [1]} {:path [:fn-tail :arity-n :bodies], :pred (clojure.core/fn [%] (clojure.core/or (clojure.core/nil? %) (clojure.core/sequential? %))), :val :-, :via [:clojure.core.specs.alpha/defn-args :clojure.core.specs.alpha/params+body :clojure.core.specs.alpha/params+body], :in [1]}), :spec #object[clojure.spec.alpha$regex_spec_impl$reify__2509 0x406684fa "clojure.spec.alpha$regex_spec_impl$reify__2509@406684fa"], :value (ticker->parsed-fname :- s/Str [ctx :- tsk/KeyMap ticker :- s/Str] (with-map-vals ctx [localdate-from localdate-to] (format "%s/%s-parsed.edn" (config/eod-historical-data-dir localdate-from localdate-to) ticker))), :args (ticker->parsed-fname :- s/Str [ctx :- tsk/KeyMap ticker :- s/Str] (with-map-vals ctx [localdate-from localdate-to] (format "%s/%s-parsed.edn" (config/eod-historical-data-dir localdate-from localdate-to) ticker)))}

borkdude 2020-11-12T20:42:02.353800Z

Maybe you could post the function itself

seancorfield 2020-11-12T20:53:50.354900Z

Sounds like a defn that has :- instead of an argument vector. I'm guessing you used defn (from core) with Schema syntax instead of Schema's own variant of defn? @ronny463

seancorfield 2020-11-12T20:54:19.355300Z

(based on :pred clojure.core/vector?, :val :- in the first line of the exception)

Ronny Li 2020-11-12T20:54:30.355400Z

that's exactly what happened, thank you 🙂