From 0126324f4193983aa97eae87152bc17c4bdd9830 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Sun, 6 Jun 2010 14:56:49 -0500 Subject: [PATCH] documented contract-stronger? --- .../scribblings/reference/contracts.scrbl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/collects/scribblings/reference/contracts.scrbl b/collects/scribblings/reference/contracts.scrbl index 8c52845b25..8ae6e79997 100644 --- a/collects/scribblings/reference/contracts.scrbl +++ b/collects/scribblings/reference/contracts.scrbl @@ -1361,6 +1361,25 @@ Extracts the predicate from a flat contract.} 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?] [v any/c]) boolean?]{