ghostwheel

Hassle-free clojure.spec, automatic generative testing, side effect detection, and evaluation tracing for Clojure(-Script) – https://github.com/gnl/ghostwheel
tony.kay 2019-08-31T00:45:41.001800Z

@dfehrenbach04 more of a question for a vscode/calva forum I would think. Whatever tells it how to resolve macro definied symbols.

Danny 2019-08-31T01:06:22.002300Z

Thanks a bunch tony! I’ll ask over there.

Danny 2019-08-31T17:06:27.006Z

@tony.kay One more thing. How do I include an s/def into the inline >defn? What I’d like to write is something along the lines of:

(>defn some-penguin-function [some-large-map] 
    [::spec-of-that-large-map => ::spec-of-that-large-map]
    (assoc some-large-map :key new-val))

tony.kay 2019-08-31T17:55:24.006800Z

@dfehrenbach04 you can say (s/keys ...) in there, but otherwise you still need to declare it and give it a name

tony.kay 2019-08-31T17:55:38.007Z

(via s/def, or in 0.4.0-SNAPSHOT via gw/>def, the latter of which will elide the def when ghostwheel is disabled, which is useful for smaller runtime builds in cljs)

Danny 2019-08-31T18:37:47.012400Z

Ah, Yes. Okay. So, I’ve been going at it all wrong for the last hours. My errors were coming from the fact that I failed to make my specs generator friendly (this is the first time I’m used spec). The generators were suggesting values that the specs (defined with s/def) were then rejecting. I pointed my finger at s/def, but that was misplaced. For example, using numbers, instead of:

(s/def ::some-val (s/and int? #(and (>= % 0) (<= % 5)))) ; number between 0 and 5 inclusive
I needed to do:
(s/def ::some-val (s/int-in 0 6))
Not to mention this was much simpler and made it generator friendly