This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-01-02
Channels
- # adventofcode (2)
- # bangalore-clj (1)
- # beginners (26)
- # boot (7)
- # cider (21)
- # clara (45)
- # cljs-dev (1)
- # cljsrn (2)
- # clojure (168)
- # clojure-berlin (1)
- # clojure-india (4)
- # clojure-italy (7)
- # clojure-nl (1)
- # clojure-russia (1)
- # clojure-spec (10)
- # clojure-uk (12)
- # clojurescript (31)
- # datascript (2)
- # datomic (28)
- # defnpodcast (9)
- # emacs (2)
- # events (4)
- # fulcro (193)
- # hoplon (127)
- # hypercrud (1)
- # jobs (1)
- # jobs-discuss (38)
- # keechma (1)
- # luminus (5)
- # off-topic (16)
- # onyx (4)
- # parinfer (9)
- # portkey (2)
- # portland-or (1)
- # precept (5)
- # re-frame (9)
- # reagent (8)
- # remote-jobs (7)
- # rum (3)
- # shadow-cljs (2)
- # spacemacs (19)
- # specter (2)
- # testing (1)
- # unrepl (34)
How would you spec this function?
(defn reducer
([] {})
([state action]
(...)))
Where state and action are specced(defn such-arity
([] "nullary")
([one] "unary")
([one two & many] "one two many"))
(s/fdef such-arity
:args (s/alt :nullary (s/cat)
:unary (s/cat :one any?)
:variadic (s/cat :one any?
:two any?
:many (s/* any?))))
I thought that could solve my validation problem with my function, but it still failing :c
that could be due to one of your specs using an s/and
and not being able to generate something that conforms to the whole spec
(s/def ::foo-map (s/and map? #(:foo %)))
(gen/sample (s/gen ::foo-map))
ExceptionInfo Couldn't satisfy such-that predicate after 100 tries. clojure.core/ex-info (core.clj:4739)