diff --git a/collects/scribblings/reference/contracts.scrbl b/collects/scribblings/reference/contracts.scrbl index d583e8679c..535d1aa126 100644 --- a/collects/scribblings/reference/contracts.scrbl +++ b/collects/scribblings/reference/contracts.scrbl @@ -1,6 +1,5 @@ #reader(lib "docreader.ss" "scribble") @require["mz.ss"] -@require[(lib "contract.ss")] @title[#:tag "mzlib:contract" #:style 'toc]{Contracts} @@ -15,6 +14,9 @@ associating a contract with a binding. @section{Flat Contracts} +A @deftech{flat contract} can be fully checked immediately for +a given value. + @defproc[(flat-contract [predicate (any/c . -> . any/c)]) flat-contract?]{ Constructs a @tech{flat contract} from @scheme[predicate]. A value @@ -335,6 +337,9 @@ error.} @section{Function Contracts} +A @deftech{function contract} wraps a procedure to delay +checks for its arguments and results. + @defform*[#:literals (any) [(-> expr ... res-expr) (-> expr ... any)]]{ diff --git a/collects/scribblings/reference/mz.ss b/collects/scribblings/reference/mz.ss index e05eec222d..f6748ebb96 100644 --- a/collects/scribblings/reference/mz.ss +++ b/collects/scribblings/reference/mz.ss @@ -4,10 +4,12 @@ (lib "eval.ss" "scribble") (lib "decode.ss" "scribble") (lib "kw.ss") + (lib "contract.ss") "../icons.ss") (provide (all-from (lib "manual.ss" "scribble")) - (all-from (lib "eval.ss" "scribble"))) + (all-from (lib "eval.ss" "scribble")) + (all-from (lib "contract.ss"))) (define AllUnix "Unix and Mac OS X") (provide AllUnix) diff --git a/collects/scribblings/reference/numbers.scrbl b/collects/scribblings/reference/numbers.scrbl index 38370e4b7a..f1a8ac474a 100644 --- a/collects/scribblings/reference/numbers.scrbl +++ b/collects/scribblings/reference/numbers.scrbl @@ -292,7 +292,7 @@ noted above). Two numbers are @scheme[equal?] when they are @examples[(truncate 17/4) (truncate -17/4) (truncate 2.5) (truncate -2.5)]} -@defproc[(numerator [x real?]) (or integer? (one-of/c +nan.0))]{ +@defproc[(numerator [x real?]) (or/c integer? (one-of/c +nan.0))]{ Coreces @scheme[x] to an exact number, finds the numerator of the number expressed in its simplest fractional form, and returns this number coerced to the exactness of @scheme[x]. An exception is when @scheme[x] is @@ -531,10 +531,10 @@ noted above). Two numbers are @scheme[equal?] when they are @; ------------------------------------------------------------------------ @section{Random Numbers} -@defproc*[([(random [k (and positive-exact-integer? - (integer-in 1 (sub1 (expt 2 31))))]) +@defproc*[([(random [k (and/c positive-exact-integer? + (integer-in 1 (sub1 (expt 2 31))))]) nonnegative-exact-integer?] - [(random) (and real? inexact? (>/c 0) (/c 0) (real [bstr bytes?] [big-endian? any/c (system-big-endian?)]) - (and real? inexact?)]{ + (and/c real? inexact?)]{ Converts the IEEE floating-point number encoded in @scheme[bstr] to an inexact real number. The @scheme[bstr] must contain either 4 or 8 @@ -680,8 +680,8 @@ least-significant eight bits, and so on.} @defproc[(real->floating-point-bytes [x real?] [size-n (one-of/c 4 8)] [big-endian? any/c (system-big-endian?)] - [dest-bstr (and bytes? - (not/c immutable?)) + [dest-bstr (and/c bytes? + (not/c immutable?)) (make-bytes size-n)]) bytes?]{