Fork me on GitHub
#clojure-spec
<
2019-07-29
>
respatialized19:07:42

at risk of asking an obvious question: how do I refer to a spec from another namespace? here's an example: in namespace-0, I have some specs defined using (s/def ::consistent ...). In namespace-1, I am using (:require [namespace-0)], but making calls to the specs in the other namespace by doing something like (s/valid :namespace-0/consistent data) fails with a Unable to resolve spec :namespace-0/consistent. How do I refer to these specs from another namespace using fully qualified keys?

respatialized19:07:58

actually, it works as expected using the fully qualified keys. my issue was just a typo in the spec name. 😑

kenny21:07:59

Is this how :gen-max is supposed to work? It appears to be a bug.

(distinct (map count
               (gen/sample
                 (s/gen (s/map-of string? string?
                                  :min-count 1
                                  :gen-max 1)) 100)))
=> (1 2)

kenny21:07:18

Ah, ok. Switched everything to use :gen-max and generators got 2-2.5x slower 😬

kenny21:07:19

I think a lot of places are only generating one item now generate up to 2.