prop/for-all should let later bindings refer to earlier bindings

Description

For example:

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

Environment

None

Activity

Show:
gfredericks
November 21, 2015, 4:13 AM

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.

gfredericks
February 14, 2018, 12:21 PM

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.

Assignee

gfredericks

Reporter

import

Labels

None

Approval

None

Patch

None

Priority

Major