prop_such_that

Filter generated values by a predicate

Returns a generator spec that draws values from source and keeps only those for which pred returns true. Gives up (with an error) after max_tries consecutive failures.

Parameters

Returns

A generator spec.

Examples

g = prop_such_that(prop_gen_int_range(-10, 10), \(x) x != 0)

See Also

prop_map_gen