This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-15
Channels
- # beginners (34)
- # boot (6)
- # cider (20)
- # cljs-dev (5)
- # clojure (7)
- # clojure-austin (1)
- # clojure-dusseldorf (10)
- # clojure-spec (11)
- # clojure-uk (3)
- # clojurescript (7)
- # cursive (1)
- # datomic (6)
- # defnpodcast (1)
- # hoplon (2)
- # luminus (32)
- # lumo (9)
- # nrepl (2)
- # nyc (1)
- # off-topic (18)
- # onyx (9)
- # portkey (3)
- # re-frame (27)
- # reagent (102)
- # shadow-cljs (70)
- # tools-deps (25)
- # vim (2)
as the doc string for s/fdef says: ” :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”
@mathpunk :args
should always be an s/cat
with each argument specified.
In your case
:args (s/cat :v :simplexity.simplex/natural-vertices)
if it has one argument, v
I've been meditating on what @alexmiller said and, i just realized, i think i figured "well a simple string is a 'regex' that matches very few things so, one argument is just a spec for the argument"
Also (:args %)
in your :fn
spec will be the collection of argument values, so you'll likely want (:v (:args %))
-- to match the :v
in the :args
spec
Read the Spec guide about spec'ing functions again to see how it uses s/cat
When I run something like "(test/check `simplex {:clojure.spec.test.alpha/opts {:num-tests 1}})" it looks like it's still running 1000 tests. :thinking_face:
Mind you, that might not be my problem --- I think I'm tucking way too much into my spec for a simplex, when I should be instead specifying the functions that act on a simplex (i.e. the ones named in the Simplex protocol). I'm a little fuzzy on how to specify functions that should be true in /every/ implementation, though...
hmm, I'm also a little unclear on how to run a generative test on a function from outside of the namespace it's defined
@mathpunk Just specify the fully-qualified name of the function to test/check
.