This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-20
Channels
- # announcements (1)
- # bangalore-clj (27)
- # beginners (82)
- # boot (4)
- # chestnut (1)
- # cider (22)
- # cljs-dev (26)
- # cljsrn (4)
- # clojure (118)
- # clojure-dev (18)
- # clojure-italy (2)
- # clojure-losangeles (1)
- # clojure-nl (2)
- # clojure-russia (1)
- # clojure-spec (15)
- # clojure-uk (125)
- # clojurescript (61)
- # core-async (74)
- # cursive (2)
- # datomic (41)
- # duct (6)
- # editors (7)
- # emacs (3)
- # events (1)
- # figwheel-main (3)
- # fulcro (111)
- # hoplon (11)
- # jobs-discuss (97)
- # lein-figwheel (99)
- # off-topic (34)
- # onyx (4)
- # parinfer (9)
- # pedestal (4)
- # precept (2)
- # re-frame (5)
- # reagent (2)
- # reitit (4)
- # ring-swagger (11)
- # shadow-cljs (104)
- # spacemacs (4)
- # tools-deps (19)
- # vim (8)
- # yada (15)
per the s/fdef doc string, ” :args A regex spec for the function arguments as they were a list to be passed to apply - in this way, a single spec can handle functions with multiple arities”
or I guess maybe the confusing thing is that regex ops nested inside each other are combined to describe the same sequential collection
so you have an effective foo args spec of (s/cat :aa (s/cat :name keyword?))
, however nested s/cats like this combine to form a spec for a single sequential collection (the args list)
what you’re wanting is that ::any-args described a new nested collection
you can do that with (s/fdef foo :args (s/cat :aa (s/spec ::any-args)))
the s/spec wrapper here forces a new (non-combined) collection level
@alexmiller Is there any issue with using (s/spec ...)
, or unintended side effects? I'm thinking about defn-spec
, within Orchestra, which provides fn specs inline. It seems like defn-spec
should expand every arg spec to be wrapped in s/spec
, based on your explanation.
I can’t speak to what Orchestra or defn-spec
does, sorry. There are possible use cases for wanting the flattening here, although I agree that’s probably unusual.
We were discussing a bit on #clojurescript about having the possibility to specify a custom printer (a la *explain-out*
) for check results.
Is it something worth working on, or at least opening a JIRA about?