8.11 Random generation
procedure
(contract-random-generate ctc [fuel fail]) → any/c
ctc : contract? fuel : 5 = exact-nonnegative-integer? fail : (or/c #f (-> any) (-> boolean? any)) = #f
The generator may fail to generate a value, either because some contracts do not have corresponding generators (for example, not all predicates have generators) or because there is not enough fuel. In either case, the function fail is invoked. If fail accepts an argument, it is called with #t when there is no generator for ctc and called with #f when there is a generator, but the generator ended up returning contract-random-generate-fail.
Changed in version 6.1.1.5 of package base: Allow fail to accept a boolean.
procedure
(contract-exercise val ...+) → void?
val : any/c
Uses value-contract to determine if any of the vals have a contract and, for those that do, uses information about the contract’s shape to poke and prod at the value. For example, if the value is function, it will use the contract to tell it what arguments to supply to the value.
procedure
(contract-random-generate/choose c fuel) → (or/c #f (-> c))
c : contract? fuel : exact-nonnegative-integer?
It chooses one of several possible generation strategies, and thus it may not actually use the generator associated with c, but might instead use a stashed value that matches c that it knows about via contract-random-generate-stash.
Added in version 6.1.1.5 of package base.
Added in version 6.1.1.5 of package base.
procedure
v : any/c
Added in version 6.1.1.5 of package base.
Added in version 6.1.1.5 of package base.
procedure
(contract-random-generate-stash env c v) → void?
env : contract-random-generate-env? c : contract? v : c
Added in version 6.1.1.5 of package base.
procedure
→ contract-random-generate-env?
Added in version 6.1.1.5 of package base.