fix up some contracts in the reference

svn: r6978
This commit is contained in:
Matthew Flatt 2007-07-27 21:49:19 +00:00
parent 5f415ecc30
commit e3c97257a1
3 changed files with 20 additions and 13 deletions

View File

@ -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)]]{

View File

@ -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)

View File

@ -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 1))])]{
[(random) (and/c real? inexact? (>/c 0) (</c 1))])]{
When called with one argument, returns a random exact integer in the
range @scheme[0] to @math{@scheme[k]-1}. The number is provided by the
@ -548,8 +548,8 @@ between @scheme[0] and @scheme[1], exclusive, using the current
pseudo-random number generator.}
@defproc[(random-seed [k (and nonnegative-exact-integer?
(integer-in 1 (sub1 (expt 2 31))))])
@defproc[(random-seed [k (and/c nonnegative-exact-integer?
(integer-in 1 (sub1 (expt 2 31))))])
void?]{
Seeds the current pseudo-random number generator with
@ -642,8 +642,8 @@ bits, and so on..}
[size-n (one-of/c 2 4 8)]
[signed? any/c]
[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?]{
@ -667,7 +667,7 @@ of length @scheme[size-n], the @exnraise[exn:fail:contract].}
@defproc[(floating-point-bytes->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?]{