Fork me on GitHub
#clojure-spec
<
2018-04-15
>
Alex Miller (Clojure team)01:04:10

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”

4
seancorfield02:04:28

@mathpunk :args should always be an s/cat with each argument specified.

seancorfield02:04:20

In your case

:args (s/cat :v :simplexity.simplex/natural-vertices)
if it has one argument, v

mathpunk02:04:43

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"

mathpunk02:04:50

now, i think i see it

seancorfield02:04:53

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

4
seancorfield02:04:28

Read the Spec guide about spec'ing functions again to see how it uses s/cat

mathpunk20:04:23

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:

mathpunk21:04:35

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...

mathpunk21:04:01

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

seancorfield22:04:35

@mathpunk Just specify the fully-qualified name of the function to test/check.