Share your thoughts in the 2024 State of Clojure Survey!

Welcome! Please see the About page for a little more info on how this works.

0 votes
in test.check by
For example:

(prop/for-all [x (gen/nat)
               y (gen/choose 0 (dec x))] ;; y is a nat less than x
  ...)

3 Answers

0 votes
by

Comment made by: gfredericks

I've thought about this before, and I'm pretty hesitant since it would probably mean using {{bind}} whenever there are multiple bindings, which means that old-style uses with independent generators would all of a sudden start shrinking poorly (due to the difficulty of shrinking {{bind}} in general).

I can see the value in consistency with {{gen/let}} though.

Another option would be an alternate {{for-all}} with the {{bind}} behavior, though I'm not sure would it would be called.

0 votes
by

Comment made by: gfredericks

Responding to my earlier comment, I think TCHECK-133 demonstrates that using {{bind}} is probably not a problem. Or at least not as big a problem as I had thought.

0 votes
by
Reference: https://clojure.atlassian.net/browse/TCHECK-85 (reported by alex+import)
...