documented contract-stronger?
This commit is contained in:
parent
054ce9d21c
commit
0126324f41
|
@ -1361,6 +1361,25 @@ Extracts the predicate from a flat contract.}
|
||||||
has a recorded contract attached to it.
|
has a recorded contract attached to it.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@defproc[(contract-stronger? [x contract?] [y contract?]) boolean?]{
|
||||||
|
Returns @racket[#t] if the contract @racket[x] accepts either fewer
|
||||||
|
or the same number of values as @racket[y] does.
|
||||||
|
|
||||||
|
This function is conservative, so it may return @racket[#f] when
|
||||||
|
@racket[x] does, in fact, accept fewer values.
|
||||||
|
|
||||||
|
@examples[#:eval (contract-eval)
|
||||||
|
(contract-stronger? integer? integer?)
|
||||||
|
(contract-stronger? (between/c 25 75) (between/c 0 100))
|
||||||
|
(contract-stronger? (between/c 0 100) (between/c 25 75))
|
||||||
|
(contract-stronger? (between/c -10 0) (between/c 0 10))
|
||||||
|
|
||||||
|
(contract-stronger? (λ (x) (and (real? x) (<= x (random 10))))
|
||||||
|
(λ (x) (and (real? x) (<= x (+ 100 (random 10))))))]
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@defproc[(contract-first-order-passes? [contract contract?]
|
@defproc[(contract-first-order-passes? [contract contract?]
|
||||||
[v any/c])
|
[v any/c])
|
||||||
boolean?]{
|
boolean?]{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user