fix ~300 typos reported by Vladimir Nesterovich (a.k.a. Gwyth)
--- but Gwyth's amazingly helpful review of chapters 1-11 pointed out a few problems that are more difficult to fix and are still pending
This commit is contained in:
parent
6a34dce36d
commit
3bb120545f
|
@ -54,7 +54,7 @@ Puts @scheme[v] into @scheme[ach], blocking if @scheme[ach]'s buffer
|
|||
is full until space is available.}
|
||||
|
||||
|
||||
@defproc[(async-channel-put-evt [async-channel channel?] [v any/c])
|
||||
@defproc[(async-channel-put-evt [ach channel?] [v any/c])
|
||||
evt?]{
|
||||
|
||||
Returns a @tech{synchronizable event} that is blocked while
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
True and false @deftech{booleans} are represented by the values
|
||||
@scheme[#t] and @scheme[#f], respectively, though operations that
|
||||
depend a boolean value typically treat anything other than @scheme[#f]
|
||||
depend on a boolean value typically treat anything other than @scheme[#f]
|
||||
as true.
|
||||
|
||||
See also: @scheme[and], @scheme[or], @scheme[andmap], @scheme[ormap].
|
||||
|
@ -155,7 +155,7 @@ type. The property value must be a list of three procedures:
|
|||
an instance of the structure type (or one of its subtypes) to
|
||||
which the property is associated.
|
||||
|
||||
The second argument is a @scheme[equal-hash-code]-like
|
||||
The second argument is an @scheme[equal-hash-code]-like
|
||||
procedure to use for recursive hash-code computation; use the
|
||||
given procedure instead of @scheme[equal-hash-code] to ensure
|
||||
that data cycles are handled properly.}
|
||||
|
|
|
@ -42,7 +42,7 @@ exceptions, during the transitions between @racket[pre-thunk]s and
|
|||
transitions for a continuation jump. For example, if breaks are
|
||||
disabled when a continuation is invoked, and if breaks are also
|
||||
disabled in the target continuation, then breaks will remain disabled
|
||||
until from the time of the invocation until the target continuation
|
||||
from the time of the invocation until the target continuation
|
||||
executes unless a relevant @racket[dynamic-wind] @racket[pre-thunk] or
|
||||
@racket[post-thunk] explicitly enables breaks.
|
||||
|
||||
|
@ -106,7 +106,7 @@ value, breaks are enabled.}
|
|||
|
||||
@defform[(parameterize-break boolean-expr body ...+)]{Evaluates
|
||||
@racket[boolean-expr] to determine whether breaks are initially
|
||||
enabled in while evaluating the @racket[body]s in sequence. The result
|
||||
enabled while evaluating the @racket[body]s in sequence. The result
|
||||
of the @racket[parameter-break] expression is the result of the last
|
||||
@racket[expr].
|
||||
|
||||
|
@ -120,7 +120,7 @@ threads.}
|
|||
@defproc[(current-break-parameterization) break-parameterization?]{
|
||||
Analogous to @racket[(current-parameterization)] (see
|
||||
@secref["parameters"]); it returns a break-parameterization
|
||||
(effectively a thread cell) that holds the current continuation's
|
||||
(effectively, a thread cell) that holds the current continuation's
|
||||
break-enable state.}
|
||||
|
||||
@defproc[(call-with-break-parameterization
|
||||
|
|
|
@ -155,19 +155,19 @@ string.
|
|||
|
||||
|
||||
@defproc[(bytes->list [bstr bytes?]) (listof byte?)]{ Returns a new
|
||||
list of bytes coresponding to the content of @scheme[bstr]. That is,
|
||||
list of bytes corresponding to the content of @scheme[bstr]. That is,
|
||||
the length of the list is @scheme[(bytes-length bstr)], and the
|
||||
sequence of bytes of @scheme[bstr] are in the same sequence in the
|
||||
sequence of bytes of @scheme[bstr] is the same sequence in the
|
||||
result list.
|
||||
|
||||
@mz-examples[(bytes->list #"Apple")]}
|
||||
|
||||
|
||||
@defproc[(list->bytes [lst (listof byte?)]) bytes?]{ Returns a new
|
||||
mutable bytes whose content is the list of bytes in @scheme[lst].
|
||||
That is, the length of the bytes is @scheme[(length lst)], and
|
||||
mutable byte string whose content is the list of bytes in @scheme[lst].
|
||||
That is, the length of the byte string is @scheme[(length lst)], and
|
||||
the sequence of bytes in @scheme[lst] is in the same sequence in
|
||||
the result bytes.
|
||||
the result byte string.
|
||||
|
||||
@mz-examples[(list->bytes (list 65 112 112 108 101))]}
|
||||
|
||||
|
@ -441,7 +441,7 @@ Certain encoding combinations are always available:
|
|||
@item{@scheme[(bytes-open-converter "platform-UTF-8" "platform-UTF-16")]
|
||||
--- converts UTF-8 to UTF-16 under @|AllUnix|, where each UTF-16
|
||||
code unit is a sequence of two bytes ordered by the current
|
||||
platform's endianess. Under Windows, the input can include
|
||||
platform's endianness. Under Windows, the input can include
|
||||
encodings that are not valid UTF-8, but which naturally extend the
|
||||
UTF-8 encoding to support unpaired surrogate code units, and the
|
||||
output is a sequence of UTF-16 code units (as little-endian byte
|
||||
|
@ -514,7 +514,7 @@ Closes the given converter, so that it can no longer be used with
|
|||
Converts the bytes from @scheme[src-start-pos] to @scheme[src-end-pos]
|
||||
in @scheme[src-bstr].
|
||||
|
||||
If @scheme[dest-bstr] is not @scheme[#f], the converted byte are
|
||||
If @scheme[dest-bstr] is not @scheme[#f], the converted bytes are
|
||||
written into @scheme[dest-bstr] from @scheme[dest-start-pos] to
|
||||
@scheme[dest-end-pos]. If @scheme[dest-bstr] is @scheme[#f], then a
|
||||
newly allocated byte string holds the conversion results, and if
|
||||
|
|
|
@ -479,10 +479,10 @@ a syntax error.
|
|||
...)
|
||||
]{
|
||||
|
||||
Like @scheme[class*], but includes a sub-expression to use used as the
|
||||
Like @scheme[class*], but includes a sub-expression to be used as the
|
||||
source for all syntax errors within the class definition. For example,
|
||||
@scheme[define-serializable-class] expands to @scheme[class/derived]
|
||||
so that error in the body of the class are reported in terms of
|
||||
so that errors in the body of the class are reported in terms of
|
||||
@scheme[define-serializable-class] instead of @scheme[class].
|
||||
|
||||
The @scheme[original-datum] is the original expression to use for
|
||||
|
@ -556,7 +556,7 @@ by-position arguments.
|
|||
|
||||
Arguments provided by position are converted into by-name arguments
|
||||
using the order of @scheme[init] and @scheme[init-field] clauses and
|
||||
the order of variables within each clause. When a @scheme[instantiate]
|
||||
the order of variables within each clause. When an @scheme[instantiate]
|
||||
form provides both by-position and by-name arguments, the converted
|
||||
arguments are placed before by-name arguments. (The order can be
|
||||
significant; see also @secref["objcreation"].)
|
||||
|
@ -712,7 +712,7 @@ of augmenting methods that would be ignored.
|
|||
|
||||
Always accesses the superclass method, independent of whether the
|
||||
method is overridden again in subclasses. Using the @scheme[super]
|
||||
form outside of @scheme[class*] is an syntax error. Each @scheme[arg]
|
||||
form outside of @scheme[class*] is a syntax error. Each @scheme[arg]
|
||||
is as for @scheme[#%app]: either @scheme[_arg-expr] or
|
||||
@scheme[_keyword _arg-expr].
|
||||
|
||||
|
@ -804,8 +804,8 @@ the class expression (including within @scheme[super] or
|
|||
a single @scheme[id] is provided for a method declaration, the
|
||||
identifier is used for both the internal and external names.
|
||||
|
||||
Method inheritance, overriding, and augmentation are based external
|
||||
names, only. Separate internal and external names are required for
|
||||
Method inheritance, overriding, and augmentation are based on external
|
||||
names only. Separate internal and external names are required for
|
||||
@scheme[rename-super] and @scheme[rename-inner] (for historical
|
||||
reasons, mainly).
|
||||
|
||||
|
@ -829,7 +829,7 @@ name. Overall, each internal identifier must be distinct from all
|
|||
other internal identifiers, each external method name must be distinct
|
||||
from all other method names, each external field name must be distinct
|
||||
from all other field names, and each initialization argument name must
|
||||
be distinct from all other initialization argument names
|
||||
be distinct from all other initialization argument names.
|
||||
|
||||
By default, external names have no lexical scope, which means, for
|
||||
example, that an external method name matches the same syntactic
|
||||
|
@ -862,9 +862,9 @@ symbolic form.
|
|||
|
||||
The binding introduced by @scheme[define-local-member-name] is a
|
||||
syntax binding that can be exported and imported with
|
||||
@scheme[module]s. Each execution of a
|
||||
@scheme[module]s. Each evaluation of a
|
||||
@scheme[define-local-member-name] declaration generates a distinct
|
||||
hidden name (except as a top-level definitions). The
|
||||
hidden name (except as a top-level definition). The
|
||||
@scheme[interface->method-names] procedure does not expose hidden
|
||||
names.
|
||||
|
||||
|
@ -974,7 +974,7 @@ expressions are evaluated as they appear in the class expression,
|
|||
from left to right.
|
||||
|
||||
Sometime during the evaluation of the expressions,
|
||||
superclass-declared initializations must be executed once by
|
||||
superclass-declared initializations must be evaluated once by
|
||||
using the @scheme[super-make-object] procedure,
|
||||
@scheme[super-new] form, or @scheme[super-instantiate] form.
|
||||
|
||||
|
@ -999,7 +999,7 @@ invoked more than once, the @exnraise[exn:fail:object].
|
|||
Fields inherited from a superclass are not initialized until the
|
||||
superclass's initialization procedure is invoked. In contrast,
|
||||
all methods are available for an object as soon as the object is
|
||||
created; the overriding of methods is not affect by
|
||||
created; the overriding of methods is not affected by
|
||||
initialization (unlike objects in C++).
|
||||
|
||||
|
||||
|
@ -1052,7 +1052,7 @@ arguments. See @secref["objcreation"] for more information.}
|
|||
@section[#:tag "ivaraccess"]{Field and Method Access}
|
||||
|
||||
In expressions within a class definition, the initialization
|
||||
variables, fields, and methods of the class all part of the
|
||||
variables, fields, and methods of the class are all part of the
|
||||
environment. Within a method body, only the fields and other methods
|
||||
of the class can be referenced; a reference to any other
|
||||
class-introduced identifier is a syntax error. Elsewhere within the
|
||||
|
@ -1131,7 +1131,7 @@ is the same as
|
|||
|
||||
Extracts methods from an object and binds a local name that can be
|
||||
applied directly (in the same way as declared methods within a class)
|
||||
for each method. The each @scheme[obj-expr] must produce an object,
|
||||
for each method. Each @scheme[obj-expr] must produce an object,
|
||||
which must have a public method named by the corresponding
|
||||
@scheme[method-id]. The corresponding @scheme[id] is bound so that it
|
||||
can be applied directly (see @secref["methodcalls"]).
|
||||
|
@ -1180,7 +1180,7 @@ the @exnraise[exn:fail:object].}
|
|||
|
||||
@defform[(field-bound? id obj-expr)]{
|
||||
|
||||
Produces @scheme[#t] if the object result of @scheme[obj-expr] has an
|
||||
Produces @scheme[#t] if the object result of @scheme[obj-expr] has a
|
||||
field with (external) name @scheme[id], @scheme[#f] otherwise.
|
||||
|
||||
If @scheme[obj-expr] does not produce an object, the
|
||||
|
@ -1408,21 +1408,21 @@ the trait is later converted to a mixin and applied to a class.}
|
|||
|
||||
Produces a new @tech{trait} that is like the @tech{trait} result of
|
||||
@scheme[trait-expr], but with the definition of a method named by
|
||||
@scheme[id] removed; as the method definition is removed, either a
|
||||
@scheme[id] removed; as the method definition is removed, either an
|
||||
@scheme[inherit], @scheme[inherit/super], or @scheme[inherit/inner]
|
||||
declaration is added:
|
||||
|
||||
@itemize[
|
||||
|
||||
@item{A method declared with @scheme[public], @scheme[pubment], or
|
||||
@scheme[public-final] is replaced with a @scheme[inherit]
|
||||
@scheme[public-final] is replaced with an @scheme[inherit]
|
||||
declaration.}
|
||||
|
||||
@item{A method declared with @scheme[override] or @scheme[override-final]
|
||||
is replaced with a @scheme[inherit/super] declaration.}
|
||||
is replaced with an @scheme[inherit/super] declaration.}
|
||||
|
||||
@item{A method declared with @scheme[augment], @scheme[augride], or
|
||||
@scheme[augment-final] is replaced with a @scheme[inherit/inner] declaration.}
|
||||
@scheme[augment-final] is replaced with an @scheme[inherit/inner] declaration.}
|
||||
|
||||
@item{A method declared with @scheme[overment] is not replaced
|
||||
with any @scheme[inherit] declaration.}
|
||||
|
@ -1459,7 +1459,7 @@ Produces a new @tech{trait} that is like the @tech{trait} result of
|
|||
@scheme[trait-expr], but all definitions and references to methods
|
||||
named @scheme[id] are replaced by definitions and references to
|
||||
methods named by @scheme[new-id]. The consistency requirements for the
|
||||
resulting trait is the same as for @scheme[trait-sum], otherwise the
|
||||
resulting trait are the same as for @scheme[trait-sum], otherwise the
|
||||
@exnraise[exn:fail:contract].}
|
||||
|
||||
|
||||
|
@ -1469,7 +1469,7 @@ Produces a new @tech{trait} that is like the @tech{trait} result of
|
|||
@scheme[trait-expr], but all definitions and references to fields
|
||||
named @scheme[id] are replaced by definitions and references to fields
|
||||
named by @scheme[new-id]. The consistency requirements for the
|
||||
resulting trait is the same as for @scheme[trait-sum], otherwise the
|
||||
resulting trait are the same as for @scheme[trait-sum], otherwise the
|
||||
@exnraise[exn:fail:contract].}
|
||||
|
||||
@; ------------------------------------------------------------------------
|
||||
|
@ -1702,7 +1702,7 @@ Returns a flat contract that recognizes classes that implement
|
|||
|
||||
@defproc[(subclass?/c [class class?]) flat-contract?]{
|
||||
|
||||
Returns a flat-contract that recognizes classes that
|
||||
Returns a flat contract that recognizes classes that
|
||||
are subclasses of @scheme[class].}
|
||||
|
||||
|
||||
|
@ -1710,7 +1710,7 @@ are subclasses of @scheme[class].}
|
|||
|
||||
@section[#:tag "objectequality"]{Object Equality and Hashing}
|
||||
|
||||
But default, objects that are instances of different classes or that
|
||||
By default, objects that are instances of different classes or that
|
||||
are instances of a non-transparent class are @scheme[equal?] only if
|
||||
they are @scheme[eq?]. Like transparent structures, two objects that
|
||||
are instances of the same transparent class (i.e., every superclass of
|
||||
|
@ -1733,7 +1733,7 @@ analogous to the functions provided for a structure type with
|
|||
is an object that is an instance of the same class (or a subclass
|
||||
that does not re-declare its implementation of @scheme[equal<%>])
|
||||
and that is being compared to the target object. The second argument
|
||||
is a @scheme[equal?]-like procedure of two arguments that should be
|
||||
is an @scheme[equal?]-like procedure of two arguments that should be
|
||||
used for recursive equality testing. The result should be a true
|
||||
value if the object and the first argument of the method are equal,
|
||||
@scheme[#f] otherwise.}
|
||||
|
@ -1774,7 +1774,7 @@ Binds @scheme[class-id] to a class, where @scheme[superclass-expr],
|
|||
the @scheme[interface-expr]s, and the @scheme[class-clause]s are as in
|
||||
@scheme[class*].
|
||||
|
||||
This forms can only be used at the top level, either within a module
|
||||
This form can only be used at the top level, either within a module
|
||||
or outside. The @scheme[class-id] identifier is bound to the new
|
||||
class, and @schemeidfont{deserialize-info:}@scheme[class-id] is also
|
||||
defined; if the definition is within a module, then the latter is
|
||||
|
@ -1833,7 +1833,7 @@ for instances of non-serializable subclasses.}
|
|||
class-clause ...)
|
||||
]{
|
||||
|
||||
Like @scheme[define-serializable-class*], but with not interface
|
||||
Like @scheme[define-serializable-class*], but without interface
|
||||
expressions (analogous to @scheme[class]).}
|
||||
|
||||
|
||||
|
@ -1857,7 +1857,7 @@ The @scheme[printable<%>] interface includes only the
|
|||
@scheme[custom-print], @scheme[custom-write], and
|
||||
@scheme[custom-display] methods. The @scheme[custom-print] method
|
||||
accepts two arguments: the destination port and the current
|
||||
@scheme[quaisquote] depth as an exact nonnegative integer. The
|
||||
@scheme[quasiquote] depth as an exact nonnegative integer. The
|
||||
@scheme[custom-write] and @scheme[custom-display] methods each accepts
|
||||
a single argument, which is the destination port to @scheme[write] or
|
||||
@scheme[display] the object.
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
Racket supports multiple threads of control within a program,
|
||||
thread-local storage, some primitive synchronization mechanisms, and a
|
||||
framework for composing synchronization abstractions. In addition, the
|
||||
@scheme[racket/future] library provides some support for parallelism
|
||||
to improve performance.
|
||||
@scheme[racket/future] and @racket[racket/place] libraries provide
|
||||
support for parallelism to improve performance.
|
||||
|
||||
@local-table-of-contents[]
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ Returns a newly-created list containing the marks for @racket[key-v]
|
|||
in @racket[mark-set], which is a set of marks returned by
|
||||
@racket[current-continuation-marks]. The result list is truncated at
|
||||
the first point, if any, where continuation frames were originally
|
||||
separated by a prompt tagged with @racket[prompt-tag]..}
|
||||
separated by a prompt tagged with @racket[prompt-tag].}
|
||||
|
||||
@defproc[(continuation-mark-set->list*
|
||||
[mark-set continuation-mark-set?]
|
||||
|
|
|
@ -59,7 +59,7 @@ the result of the @racket[call-with-continuation-prompt] call.
|
|||
The @racket[handler] argument specifies a handler procedure to be
|
||||
called in tail position with respect to the
|
||||
@racket[call-with-continuation-prompt] call when the installed prompt
|
||||
is the target of a @racket[abort-current-continuation] call with
|
||||
is the target of an @racket[abort-current-continuation] call with
|
||||
@racket[prompt-tag]; the remaining arguments of
|
||||
@racket[abort-current-continuation] are supplied to the handler
|
||||
procedure. If @racket[handler] is @racket[#f], the default handler
|
||||
|
@ -80,7 +80,7 @@ as arguments to the target prompt's handler procedure.
|
|||
|
||||
The protocol for @racket[v]s supplied to an abort is specific to the
|
||||
@racket[prompt-tag]. When @racket[abort-current-continuation] is used with
|
||||
@racket[(default-continuation-prompt-tag)], generally a single thunk
|
||||
@racket[(default-continuation-prompt-tag)], generally, a single thunk
|
||||
should be supplied that is suitable for use with the default prompt
|
||||
handler. Similarly, when @racket[call-with-continuation-prompt] is
|
||||
used with @racket[(default-continuation-prompt-tag)], the associated
|
||||
|
@ -99,7 +99,7 @@ argument, if supplied, is used when printing the prompt tag.}
|
|||
Returns a constant prompt tag for which a prompt is installed at the
|
||||
start of every thread's continuation; the handler for each thread's
|
||||
initial prompt accepts any number of values and returns. The result of
|
||||
@racket[default-continuation-prompt-tag] is the default tag for more
|
||||
@racket[default-continuation-prompt-tag] is the default tag for
|
||||
any procedure that accepts a prompt tag.}
|
||||
|
||||
@defproc[(call-with-current-continuation
|
||||
|
@ -157,7 +157,7 @@ Similar to @racket[call-with-current-continuation], but applying
|
|||
the resulting continuation procedure does not remove any portion of
|
||||
the current continuation. Instead, application always extends the
|
||||
current continuation with the captured continuation (without
|
||||
installing any prompts other than those be captured in the
|
||||
installing any prompts other than those captured in the
|
||||
continuation).
|
||||
|
||||
When @racket[call-with-composable-continuation] is called, if a
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
@guideintro["contracts"]{contracts}
|
||||
|
||||
The contract system guards one part of a program from
|
||||
another. Programmers specify the behavior of a module exports via
|
||||
@racket[provide/contract] and the contract system enforces those
|
||||
another. Programmers specify the behavior of a module's exports via
|
||||
@racket[provide/contract], and the contract system enforces those
|
||||
constraints.
|
||||
|
||||
@note-lib[racket/contract #:use-sources (racket/contract/private/ds
|
||||
|
@ -100,7 +100,7 @@ A @tech{flat contract} that accepts no values.}
|
|||
|
||||
Takes any number of contracts and returns
|
||||
a contract that accepts any value that any one of the contracts
|
||||
accepts, individually.
|
||||
accepts individually.
|
||||
|
||||
The @racket[or/c] result tests any value by applying the contracts in
|
||||
order, from left to right, with the exception that it always moves the
|
||||
|
@ -137,8 +137,8 @@ with the function.
|
|||
@defproc[(and/c [contract (or/c contract? (any/c . -> . any/c))] ...)
|
||||
contract?]{
|
||||
|
||||
Takes any number of contracts and returns a contract that checks that
|
||||
accepts any value that satisfies all of the contracts, simultaneously.
|
||||
Takes any number of contracts and returns a contract that
|
||||
accepts any value that satisfies all of the contracts simultaneously.
|
||||
|
||||
If all of the arguments are procedures or @tech{flat contracts},
|
||||
the result is a @tech{flat contract}.
|
||||
|
@ -163,7 +163,7 @@ Returns a flat contract that requires the input to be a number and
|
|||
@defproc[(</c [n real?]) flat-contract?]{
|
||||
|
||||
Returns a flat contract that requires the input to be a number and
|
||||
@racket[<] to @racket[n].}
|
||||
@racket[<] than @racket[n].}
|
||||
|
||||
|
||||
@defproc[(>/c [n real?]) flat-contract?]{
|
||||
|
@ -179,7 +179,7 @@ Like @racket[</c], but for @racket[>=].}
|
|||
|
||||
@defproc[(between/c [n real?] [m real?])
|
||||
flat-contract?]{ Returns a flat contract that requires the
|
||||
input to be a between @racket[n] and @racket[m] or equal to
|
||||
input to be a real number between @racket[n] and @racket[m] or equal to
|
||||
one of them.}
|
||||
|
||||
@defproc[(real-in [n real?] [m real?]) flat-contract?]{
|
||||
|
@ -260,7 +260,7 @@ reasons of backwards compatibility, and may be removed in the future.}
|
|||
[#:immutable immutable (or/c #t #f 'dont-care) 'dont-care]
|
||||
[#:flat? flat? boolean? #f])
|
||||
contract?]{
|
||||
Returns a contract that recognizes vectors whose length match the number of
|
||||
Returns a contract that recognizes vectors whose lengths match the number of
|
||||
contracts given. Each element of the vector must match its corresponding contract.
|
||||
|
||||
If the @racket[flat?] argument is @racket[#t], then the resulting contract is
|
||||
|
@ -324,7 +324,7 @@ a value, the result is not necessarily @racket[eq?] to the input.}
|
|||
|
||||
@defproc[(cons/c [car-c contract?] [cdr-c contract?]) contract?]{
|
||||
|
||||
Produces a contract the recognizes pairs first and second elements
|
||||
Produces a contract the recognizes pairs whose first and second elements
|
||||
match @racket[car-c] and @racket[cdr-c], respectively. Beware that
|
||||
when this contract is applied to a value, the result is not
|
||||
necessarily @racket[eq?] to the input.}
|
||||
|
@ -389,7 +389,7 @@ to the input. The result will be a copy for immutable hash tables, and either a
|
|||
}
|
||||
|
||||
|
||||
@defform[(flat-rec-contract id flat-contract-expr ...)]
|
||||
@defform[(flat-rec-contract id flat-contract-expr ...)]{
|
||||
|
||||
Constructs a recursive @tech{flat contract}. A
|
||||
@racket[flat-contract-expr] can refer to @racket[id] to refer
|
||||
|
@ -405,7 +405,7 @@ For example, the contract
|
|||
]
|
||||
|
||||
is a flat contract that checks for (a limited form of)
|
||||
S-expressions. It says that an @racket[sexp] is either two
|
||||
S-expressions. It says that a @racket[sexp] is either two
|
||||
@racket[sexp] combined with @racket[cons], or a number, or a symbol.
|
||||
|
||||
Note that if the contract is applied to a circular value, contract
|
||||
|
@ -450,7 +450,7 @@ result value meets the contract produced by @racket[expr].}
|
|||
describes the identity function (or a non-terminating function)
|
||||
That is, the first use of the @racket[a] appears in a
|
||||
negative position and thus inputs to that function are wrapped with an opaque struct.
|
||||
Then, when the function returns, it is checked to see if the result is wrapped, since
|
||||
Then, when the function returns, it is checked to determine whether the result is wrapped, since
|
||||
the second @racket[a] appears in a positive position.
|
||||
|
||||
This is a dual to @racket[new-∃/c].
|
||||
|
@ -521,7 +521,7 @@ Each @racket[dom-expr] is a contract on an argument to a
|
|||
function, and each @racket[range-expr] is a contract on a
|
||||
result of the function.
|
||||
|
||||
@margin-note{Using an @racket[->] between two whitespace-delimited
|
||||
@margin-note{Using a @racket[->] between two whitespace-delimited
|
||||
@racketparenfont{.}s is the same as putting the @racket[->] right
|
||||
after the enclosing open parenthesis. See
|
||||
@guidesecref["lists-and-syntax"] or @secref["parse-pair"] for more
|
||||
|
@ -543,7 +543,7 @@ example:
|
|||
@racketblock[(integer? #:x boolean? . -> . integer?)]
|
||||
|
||||
is a contract on a function that accepts a by-position argument that
|
||||
is an integer and a @racket[#:x] argument is that a boolean.
|
||||
is an integer and a @racket[#:x] argument that is a boolean.
|
||||
|
||||
If @racket[any] is used as the last sub-form for @racket[->], no
|
||||
contract checking is performed on the result of the function, and
|
||||
|
@ -623,8 +623,8 @@ in that each argument and result is named. These names can then
|
|||
be used in the subcontracts and in the pre-/post-condition clauses.
|
||||
In short, contracts now express dependencies among arguments and results.
|
||||
|
||||
The first subforms of a @racket[->i] contract covers the mandatory and the
|
||||
second subform covers the optional arguments. Following that is an optional
|
||||
The first sub-form of a @racket[->i] contract covers the mandatory and the
|
||||
second sub-form covers the optional arguments. Following that is an optional
|
||||
rest-args contract, and an optional pre-condition. The pre-condition is
|
||||
introduced with the @racket[#:pre] keyword followed by the list of names on
|
||||
which it depends.
|
||||
|
@ -666,14 +666,14 @@ dependencies. That is, if a contract for an argument depends on the value
|
|||
of some other contract, the former is evaluated first (so that the
|
||||
argument, with its contract checked, is available for the other). When
|
||||
there is no dependency between two arguments (or the result and an
|
||||
argument) then the contract that appears earlier in the source text is
|
||||
argument), then the contract that appears earlier in the source text is
|
||||
evaluated first.
|
||||
#;
|
||||
Finally, if all of the identifier positions of the range
|
||||
contract are @racket[_]s (underscores), then the range contract expressions
|
||||
are evaluated when the function is called and the underscore is not bound
|
||||
in the range, after the argument contracts are evaluated and
|
||||
checked. Otherwise the range expressions are evaluated when the function
|
||||
checked. Otherwise, the range expressions are evaluated when the function
|
||||
returns.
|
||||
|
||||
If there are optional arguments that are not supplied, then
|
||||
|
@ -717,7 +717,7 @@ this contract
|
|||
any)]
|
||||
will allow @racket[f] to be called with @racket[#f], trigger whatever bad
|
||||
behavior the author of @scheme[f] was trying to prohibit by insisting that
|
||||
@racket[f]'s contract accept ony integers.
|
||||
@racket[f]'s contract accept only integers.
|
||||
|
||||
The @racket[#:pre-cond] and @racket[#:post-cond] keywords are synonyms for
|
||||
@racket[#:pre] and @racket[#:post] and are provided for backwards compatibility.
|
||||
|
@ -780,7 +780,7 @@ be blamed using the above contract:
|
|||
}
|
||||
|
||||
@defproc[(unsupplied-arg? [v any/c]) boolean?]{
|
||||
A predicate to determine if @racket[v] is
|
||||
A predicate to determine whether @racket[v] is
|
||||
@racket[the-unsupplied-arg].
|
||||
}
|
||||
|
||||
|
@ -792,7 +792,7 @@ be blamed using the above contract:
|
|||
|
||||
Like @racket[struct], but with two differences:
|
||||
they do not
|
||||
define field mutators, and the do define two contract constructors:
|
||||
define field mutators, and they define two contract constructors:
|
||||
@racket[id]@racketidfont{/c} and @racket[id]@racketidfont{/dc}. The
|
||||
first is a procedure that accepts as many arguments as there are
|
||||
fields and returns a contract for struct values whose fields match the
|
||||
|
@ -824,7 +824,7 @@ indicate which fields it depends on; these dependencies can only be to
|
|||
earlier fields.}}
|
||||
|
||||
@defform[(define-contract-struct id (field-id ...))]{
|
||||
Like @racket[contract-struct], but where the maker's name is @racketidfont["make-"]@racket[id],
|
||||
Like @racket[contract-struct], but where the constructor's name is @racketidfont["make-"]@racket[id],
|
||||
much like @racket[define-struct].
|
||||
}
|
||||
|
||||
|
@ -872,7 +872,7 @@ traversed, since the contract checker will traverse it before the
|
|||
function is called. As written above, however, when the product
|
||||
function aborts the traversal of the list, the contract checking also
|
||||
stops, since the @racket[kons/dc] contract constructor generates a
|
||||
lazy contract.}
|
||||
lazy contract.
|
||||
|
||||
@; ------------------------------------------------------------------------
|
||||
|
||||
|
@ -919,7 +919,7 @@ referring to the structure type to export and the second name
|
|||
referring to the parent structure type. Unlike a @racket[struct]
|
||||
definition, however, all of the fields (and their contracts) must be
|
||||
listed. The contract on the fields that the sub-struct shares with its
|
||||
parent are only used in the contract for the sub-struct's maker, and
|
||||
parent are only used in the contract for the sub-struct's constructor, and
|
||||
the selector or mutators for the super-struct are not provided. The
|
||||
exported structure-type name always doubles as a constructor, even if
|
||||
the original structure-type name does not act as a constructor.
|
||||
|
@ -982,7 +982,7 @@ For the definition of @racket[free-var-list], see @racket[with-contract].
|
|||
|
||||
The @racket[define/contract] form treats the individual definition as
|
||||
a contract region. The definition itself is responsible for positive
|
||||
(co-variant) positions of the contract and references to
|
||||
(co-variant) positions of the contract, and references to
|
||||
@racket[id] outside of the definition must meet the negative
|
||||
positions of the contract. Since the contract boundary is
|
||||
between the definition and the surrounding context, references to
|
||||
|
@ -1149,18 +1149,18 @@ Compare that to the projection for our function contract:
|
|||
]
|
||||
|
||||
In this case, the only explicit blame covers the situation
|
||||
where either a non-procedure is supplied to the contract, or
|
||||
where the procedure does not accept one argument. As with
|
||||
where either a non-procedure is supplied to the contract or
|
||||
the procedure does not accept one argument. As with
|
||||
the integer projection, the blame here also lies with the
|
||||
producer of the value, which is
|
||||
why @racket[raise-blame-error] is passed @racket[blame] unchanged.
|
||||
|
||||
The checking for the domain and range are delegated to
|
||||
the @racket[int-proj] function, which is supplied its
|
||||
arguments in the first two line of
|
||||
arguments in the first two lines of
|
||||
the @racket[int->int-proj] function. The trick here is that,
|
||||
even though the @racket[int->int-proj] function always
|
||||
blames what it sees as positive we can swap the blame parties by
|
||||
blames what it sees as positive, we can swap the blame parties by
|
||||
calling @racket[blame-swap] on the given @tech{blame object}, replacing
|
||||
the positive party with the negative party and vice versa.
|
||||
|
||||
|
@ -1174,7 +1174,7 @@ has to go from the original, providing module to the
|
|||
requiring module. Now, imagine that the providing module
|
||||
invokes the function, suppying it an argument. At this
|
||||
point, the flow of values reverses. The argument is
|
||||
travelling back from the requiring module to the providing
|
||||
traveling back from the requiring module to the providing
|
||||
module! And finally, when the function produces a result,
|
||||
that result flows back in the original
|
||||
direction. Accordingly, the contract on the domain reverses
|
||||
|
@ -1244,19 +1244,19 @@ the contract library primitives below.
|
|||
|
||||
These functions build simple higher-order contracts, chaperone contracts, and flat contracts,
|
||||
respectively. They both take the same set of three optional arguments: a name,
|
||||
a first order predicate, and a blame-tracking projection.
|
||||
a first-order predicate, and a blame-tracking projection.
|
||||
|
||||
The @racket[name] argument is any value to be rendered using @racket[display] to
|
||||
describe the contract when a violation occurs. The default name for simple
|
||||
higher order contracts is @racketresult[anonymous-contract], for chaperone
|
||||
higher-order contracts is @racketresult[anonymous-contract], for chaperone
|
||||
contracts is @racketresult[anonymous-chaperone-contract], and for flat
|
||||
contracts is @racketresult[anonymous-flat-contract].
|
||||
|
||||
The first order predicate @racket[test] can be used to determine which values
|
||||
the contract applies to; usually this is the set of values for which the
|
||||
The first-order predicate @racket[test] can be used to determine which values
|
||||
the contract applies to; usually, this is the set of values for which the
|
||||
contract fails immediately without any higher-order wrapping. This test is used
|
||||
by @racket[contract-first-order-passes?], and indirectly by @racket[or/c] to
|
||||
determine which of multiple higher order contracts to wrap a value with. The
|
||||
determine which of multiple higher-order contracts to wrap a value with. The
|
||||
default test accepts any value.
|
||||
|
||||
The projection @racket[proj] defines the behavior of applying the contract. It
|
||||
|
@ -1265,11 +1265,11 @@ object, and the second accepts a value to protect with the contract. The
|
|||
projection must either produce the value, suitably wrapped to enforce any
|
||||
higher-order aspects of the contract, or signal a contract violation using
|
||||
@racket[raise-blame-error]. The default projection produces an error when the
|
||||
first order test fails, and produces the value unchanged otherwise.
|
||||
first-order test fails, and produces the value unchanged otherwise.
|
||||
|
||||
Projections for chaperone contracts must produce a value that passes
|
||||
@racket[chaperone-of?] when compared with the original, uncontracted value.
|
||||
Projections for flat contracts must fail precisely when the first order test
|
||||
Projections for flat contracts must fail precisely when the first-order test
|
||||
does, and must produce the input value unchanged otherwise. Applying a flat
|
||||
contract may result in either an application of the predicate, or the
|
||||
projection, or both; therefore, the two must be consistent. The existence of a
|
||||
|
@ -1313,15 +1313,15 @@ flat contracts do not need to supply an explicit projection.
|
|||
|
||||
Produces an S-expression to be used as a name
|
||||
for a contract. The arguments should be either contracts or
|
||||
symbols. It wraps parenthesis around its arguments and
|
||||
symbols. It wraps parentheses around its arguments and
|
||||
extracts the names from any contracts it is supplied with.}
|
||||
|
||||
@defproc[(coerce-contract [id symbol?] [x any/c]) contract?]{
|
||||
|
||||
Converts a regular racket value into an instance of a contract struct,
|
||||
Converts a regular Racket value into an instance of a contract struct,
|
||||
converting it according to the description of @tech{contracts}.
|
||||
|
||||
If @racket[x] is not one of the coercable values,
|
||||
If @racket[x] is not one of the coercible values,
|
||||
@racket[coerce-contract] signals an error, using the first argument in
|
||||
the error message.}
|
||||
|
||||
|
@ -1548,10 +1548,10 @@ These functions build the arguments for @racket[prop:contract],
|
|||
A @deftech{contract property} specifies the behavior of a structure when used as
|
||||
a contract. It is specified in terms of five accessors: @racket[get-name],
|
||||
which produces a description to @racket[write] as part of a contract violation;
|
||||
@racket[get-first-order], which produces a first order predicate to be used by
|
||||
@racket[get-first-order], which produces a first-order predicate to be used by
|
||||
@racket[contract-first-order-passes?]; @racket[get-projection], which
|
||||
produces a blame-tracking projection defining the behavior of the contract;
|
||||
@racket[stronger], which is a predicate that determines if one contract this contract
|
||||
@racket[stronger], which is a predicate that determines whether this contract
|
||||
(passed in the first argument) is stronger than some other contract (passed in the second argument);
|
||||
and @racket[generator], which makes a random value that matches the contract,
|
||||
given a size bound and an environment from which to draw interesting values.
|
||||
|
@ -1572,7 +1572,7 @@ A @deftech{flat contract property} specifies the behavior of a structure when
|
|||
used as a flat contract. It is specified using
|
||||
@racket[build-flat-contract-property], and accepts exactly the same set of
|
||||
arguments as @racket[build-contract-property]. The only difference is that the
|
||||
projection accessor is expected not to wrap its argument in a higher order
|
||||
projection accessor is expected not to wrap its argument in a higher-order
|
||||
fashion, analogous to the constraint on projections in
|
||||
@racket[make-flat-contract].
|
||||
|
||||
|
@ -1591,14 +1591,14 @@ These predicates detect whether a value is a @tech{contract property},
|
|||
@subsection{Obligation Information in Check Syntax}
|
||||
|
||||
@seclink[#:doc '(lib "scribblings/drracket/drracket.scrbl")
|
||||
"buttons"]{Check Syntax} in DrRacket shows obligations information for
|
||||
"buttons"]{Check Syntax} in DrRacket shows obligation information for
|
||||
contracts according to @racket[syntax-property]s that the contract combinators
|
||||
leave in the expanded form of the program. These properties indicate
|
||||
where contracts appears in the source and where the positive and negative
|
||||
where contracts appear in the source and where the positive and negative
|
||||
positions of the contracts appear.
|
||||
|
||||
To make Check Syntax show obligation information for your new contract
|
||||
combinators, use these properties:
|
||||
combinators, use the following properties:
|
||||
|
||||
@itemize[@item{@racketblock0['racket/contract:contract :
|
||||
(vector/c symbol? (listof syntax?) (listof syntax?))]
|
||||
|
@ -1612,7 +1612,7 @@ combinators, use these properties:
|
|||
its subpieces (specified by the two following syntax properties).
|
||||
|
||||
The second and third elements of the vector are syntax objects
|
||||
from pieces of the contract and Check Syntax will color them.
|
||||
from pieces of the contract, and Check Syntax will color them.
|
||||
The first list should contain subparts that are the responsibility
|
||||
of parties (typically modules) that provide implementations of the contract.
|
||||
The second list should contain subparts that are the
|
||||
|
@ -1641,8 +1641,8 @@ combinators, use these properties:
|
|||
@item{@racketblock0['racket/contract:contract-on-boundary : symbol?]
|
||||
The presence of this property tells Check Syntax that it
|
||||
should start coloring from this point. It expects the expression
|
||||
to alow be a contract
|
||||
(and thus to have the @racket['racket/contract:contract] property);
|
||||
to be a contract
|
||||
(and, thus, to have the @racket['racket/contract:contract] property);
|
||||
this property indicates that this contract is on a (module) boundary.
|
||||
|
||||
(The value of the property is not used.)
|
||||
|
@ -1725,7 +1725,7 @@ Extracts the predicate from a flat contract.}
|
|||
[v any/c])
|
||||
boolean?]{
|
||||
|
||||
Returns a boolean indicating if the first-order tests
|
||||
Returns a boolean indicating whether the first-order tests
|
||||
of @racket[contract] pass for @racket[v].
|
||||
|
||||
If it returns @racket[#f], the contract is guaranteed not to
|
||||
|
@ -1739,8 +1739,8 @@ Produces the name used to describe the contract in error messages.
|
|||
}
|
||||
|
||||
@defproc[(contract-first-order [c contract?]) (-> any/c boolean?)]{
|
||||
Produces the first order test used by @racket[or/c] to match values to higher
|
||||
order contracts.
|
||||
Produces the first-order test used by @racket[or/c] to match values to
|
||||
higher-order contracts.
|
||||
}
|
||||
|
||||
@defproc[(contract-projection [c contract?]) (-> blame? (-> any/c any/c))]{
|
||||
|
@ -1780,7 +1780,7 @@ the message that indicates the violation.
|
|||
(format "Contract Name: ~a\n" (blame-contract blame))
|
||||
(format "Offending Value: ~s\n" value)
|
||||
(format "Offense: ~a\n" message)))
|
||||
[current-blame-format show-blame-error]
|
||||
(current-blame-format show-blame-error)
|
||||
(define/contract (f x)
|
||||
(-> integer? integer?)
|
||||
(/ x 2))
|
||||
|
@ -1807,9 +1807,9 @@ describes the expected type of contract and must be one of the keywords
|
|||
This optimizes its argument contract expression by
|
||||
traversing its syntax and, for known contract combinators,
|
||||
fuses them into a single contract combinator that avoids as
|
||||
much allocation overhad as possible. The result is a
|
||||
much allocation overhead as possible. The result is a
|
||||
contract that should behave identically to its argument,
|
||||
except faster (due to the less allocation).}
|
||||
except faster (due to less allocation).}
|
||||
|
||||
|
||||
@defform[(define-opt/c (id id ...) expr)]{
|
||||
|
|
|
@ -50,6 +50,16 @@ to @math{4+2n} names:
|
|||
@math{m} is the number of @racket[field]s that do not include
|
||||
an @racket[#:auto] option.}
|
||||
|
||||
@item{@racket[id], a @tech{transformer binding} that encapsulates
|
||||
information about the structure type declaration. This binding
|
||||
is used to define subtypes, and it also works with the
|
||||
@racket[shared] and @racket[match] forms. For detailed
|
||||
information about the binding of @racket[id], see
|
||||
@secref["structinfo"].
|
||||
|
||||
The @racket[constructor-id] and @racket[id] can be the same, in
|
||||
which case @racket[id] performs both roles.}
|
||||
|
||||
@item{@racket[id]@racketidfont{?}, a @deftech{predicate} procedure
|
||||
that returns @racket[#t] for instances of the @tech{structure
|
||||
type} (constructed by @racket[constructor-id] or the
|
||||
|
@ -70,16 +80,6 @@ to @math{4+2n} names:
|
|||
value. The structure is destructively updated with the new
|
||||
value, and @|void-const| is returned.}
|
||||
|
||||
@item{@racket[id], a @tech{transformer binding} that encapsulates
|
||||
information about the structure type declaration. This binding
|
||||
is used to define subtypes, and it also works with the
|
||||
@racket[shared] and @racket[match] forms. For detailed
|
||||
information about the binding of @racket[id], see
|
||||
@secref["structinfo"].
|
||||
|
||||
The @racket[constructor-id] and @racket[id] can be the same, in
|
||||
which case @racket[id] performs both roles.}
|
||||
|
||||
]
|
||||
|
||||
If @racket[super-id] is provided, it must have a transformer binding
|
||||
|
@ -109,7 +109,7 @@ multiple times, attaches a property value to the structure type; see
|
|||
@racket[#:transparent] option is a shorthand for @racket[#:inspector
|
||||
#f].
|
||||
|
||||
@margin-note{Use the @racket[prop:procedure] to property implement an
|
||||
@margin-note{Use the @racket[prop:procedure] property to implement an
|
||||
@as-index{applicable structure}, use @racket[prop:evt] to create a
|
||||
structure type whose instances are @tech{synchronizable events}, and
|
||||
so on. By convention, property names start with @racketidfont{prop:}.}
|
||||
|
@ -212,7 +212,7 @@ position within the structure declaration of the field named by
|
|||
(id super-id)])]{
|
||||
|
||||
Like @racket[struct], except that the syntax for supplying a
|
||||
@racket[super-id] is different, and a @racket[_constructor-id] that is
|
||||
@racket[super-id] is different, and a @racket[_constructor-id] that has
|
||||
a @racketidfont{make-} prefix on @racket[id] is implicitly supplied
|
||||
via @racket[#:extra-constructor-name].
|
||||
|
||||
|
|
|
@ -259,7 +259,9 @@ invoked in tail position.)
|
|||
[failure-result any/c (lambda () (raise (make-exn:fail ....)))]) void?]{
|
||||
|
||||
Composes @scheme[dict-ref] and @scheme[dict-set!] to update an
|
||||
existing mapping in @scheme[dict].
|
||||
existing mapping in @scheme[dict], where the optional @racket[failure-result]
|
||||
argument is used as in @racket[dict-ref] when no mapping exists for
|
||||
@racket[key] already.
|
||||
|
||||
@examples[
|
||||
#:eval dict-eval
|
||||
|
@ -280,7 +282,9 @@ v
|
|||
(and/c dict? immutable?)]{
|
||||
|
||||
Composes @scheme[dict-ref] and @scheme[dict-set] to functionally
|
||||
update an existing mapping in @scheme[dict].
|
||||
update an existing mapping in @scheme[dict], where the optional @racket[failure-result]
|
||||
argument is used as in @racket[dict-ref] when no mapping exists for
|
||||
@racket[key] already.
|
||||
|
||||
@examples[
|
||||
#:eval dict-eval
|
||||
|
@ -312,7 +316,7 @@ h]}
|
|||
(and/c dict? immutable?)]{
|
||||
|
||||
Functionally removes any existing mapping for @scheme[key] in
|
||||
@scheme[dict], returning the updated dictionary. The update can fail
|
||||
@scheme[dict], returning the fresh dictionary. The update can fail
|
||||
if @scheme[dict] does not support functional update or does not
|
||||
support removing keys.
|
||||
|
||||
|
@ -375,7 +379,7 @@ constant time.
|
|||
@defproc[(dict-iterate-first [dict dict?]) any/c]{
|
||||
|
||||
Returns @scheme[#f] if @scheme[dict] contains no elements, otherwise
|
||||
it returns a non-@scheme[#f] value that is a index to the first
|
||||
it returns a non-@scheme[#f] value that is an index to the first
|
||||
element in the dict table; ``first'' refers to an unspecified ordering
|
||||
of the dictionary elements. For a mutable @scheme[dict], this index is
|
||||
guaranteed to refer to the first item only as long as no mappings are
|
||||
|
|
|
@ -102,7 +102,7 @@ substituting @racket[_expr] in place of @hole in the @tech{continuation}
|
|||
]
|
||||
|
||||
In this case, the @tech{continuation} for reducing @racket[(+ 1 1)] is
|
||||
@sub[_C (+ 4 @#,hole)], not just @racket[_C].
|
||||
@sub[_C (- 4 @#,hole)], not just @racket[_C].
|
||||
|
||||
In contrast, @racket[(+ 1 1)] is in @tech{tail position} with respect
|
||||
to @racket[(if (zero? 0) (+ 1 1) 3)], because, for any continuation
|
||||
|
@ -142,7 +142,7 @@ the result(s).
|
|||
|
||||
In general, the specification of a syntactic form inidicates the
|
||||
number of @tech{values} that it produces and the number that it
|
||||
expects from each of its sub-expression. In addtion, some procedures
|
||||
expects from each of its sub-expression. In addition, some procedures
|
||||
(notably @racket[values]) produce multiple @tech{values}, and some
|
||||
procedures (notably @racket[call-with-values]) create continuations
|
||||
internally that accept a certain number of @tech{values}.
|
||||
|
@ -436,7 +436,7 @@ procedure body is replaced with the new @tech{location}:
|
|||
|
||||
A @tech{location} is the same as a @tech{top-level variable}, but when
|
||||
a @tech{location} is generated, it (conceptually) uses a name that has
|
||||
not been used before and that cannot not be generated again or
|
||||
not been used before and that cannot be generated again or
|
||||
accessed directly.
|
||||
|
||||
Generating a @tech{location} in this way means that @racket[set!]
|
||||
|
@ -768,7 +768,7 @@ custodian} as determined by the @racket[current-custodian]
|
|||
|
||||
@margin-note{In GRacket, custodians also manage eventspaces.}
|
||||
|
||||
Except for the root custodian, every @tech{custodian} itself it
|
||||
Except for the root custodian, every @tech{custodian} itself is
|
||||
managed by a @tech{custodian}, so that custodians form a hierarchy.
|
||||
Every object managed by a subordinate custodian is also managed by the
|
||||
custodian's owner.
|
||||
|
|
|
@ -18,7 +18,7 @@ among threads. Certain kinds of objects double as events, including
|
|||
ports and threads. Other kinds of objects exist only for their use as
|
||||
events.
|
||||
|
||||
At an point in time, an event is either @defterm{ready} for
|
||||
At any point in time, an event is either @defterm{ready} for
|
||||
synchronization, or it is not; depending on the kind of event and how
|
||||
it is used by other threads, an event can switch from not ready to
|
||||
ready (or back), at any time. If a thread synchronizes on an event
|
||||
|
|
|
@ -169,7 +169,7 @@ The @racket[arity-v] value must
|
|||
be a possible result from @racket[procedure-arity], except
|
||||
that it does not have to be normalized (see @racket[procedure-arity?] for
|
||||
the details of normalized arities); @racket[raise-arity-error]
|
||||
will normalize the arity and used the normalized form in the error message.
|
||||
will normalize the arity and use the normalized form in the error message.
|
||||
If @racket[name] is a procedure, its actual arity is
|
||||
ignored.
|
||||
|
||||
|
@ -225,7 +225,7 @@ through a combination of the @racket[name], @racket[expr], and
|
|||
identifier's symbol.}
|
||||
|
||||
@item{When @racket[name] is @racket[#f] and when @racket[expr] is not
|
||||
an identifier or a syntax pair containing and identifier as its
|
||||
an identifier or a syntax pair containing an identifier as its
|
||||
first element, then the form name in the error message is
|
||||
@racket["?"].}
|
||||
|
||||
|
@ -259,7 +259,7 @@ the continuation; if no previous handler is available, the
|
|||
uncaught-exception handler is used (see below). In all cases, a call
|
||||
to an exception handler is @racket[parameterize-break]ed to disable
|
||||
breaks, and it is wrapped with @racket[call-with-exception-handler] to
|
||||
install the an exception handler that reports both the original and
|
||||
install the exception handler that reports both the original and
|
||||
newly raised exceptions.}
|
||||
|
||||
@defparam[uncaught-exception-handler f (any/c . -> . any)]{
|
||||
|
@ -293,7 +293,7 @@ fails.}
|
|||
|
||||
Evaluates each @racket[pred-expr] and @racket[handler-expr] in the
|
||||
order that they are specified, and then evaluates the @racket[body]s
|
||||
with a new exception handler during the its dynamic extent.
|
||||
with a new exception handler during its dynamic extent.
|
||||
|
||||
The new exception handler processes an exception only if one of the
|
||||
@racket[pred-expr] procedures returns a true value when applied to the
|
||||
|
@ -415,7 +415,7 @@ non-string is returned, then the string @racket["..."] is used. If a
|
|||
primitive error string needs to be generated before the handler has
|
||||
returned, the default error value conversion handler is used.
|
||||
|
||||
Call to an error value conversion handler are @racket[parameterize]d
|
||||
Calls to an error value conversion handler are @racket[parameterize]d
|
||||
to re-install the default error value conversion handler, and to
|
||||
enable printing of unreadable values (see @racket[print-unreadable]).}
|
||||
|
||||
|
@ -548,7 +548,7 @@ platform or configuration.}
|
|||
@defstruct[(exn:fail:user exn:fail) ()
|
||||
#:inspector #f]{
|
||||
|
||||
Raised for errors that are intended to be seen by end-users. In
|
||||
Raised for errors that are intended to be seen by end users. In
|
||||
particular, the default error printer does not show the program
|
||||
context when printing the error message.}
|
||||
|
||||
|
@ -591,7 +591,7 @@ Returns the @racket[srcloc]-getting procedure associated with @racket[v].}
|
|||
[span (or/c exact-nonnegative-integer? #f)])
|
||||
#:inspector #f]{
|
||||
|
||||
The fields of an @racket[srcloc] instance are as follows:
|
||||
The fields of a @racket[srcloc] instance are as follows:
|
||||
|
||||
@itemize[
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ Safe versions of @racket[unsafe-fx->fl] and @racket[unsafe-fl->fx].}
|
|||
@section{Fixnum Vectors}
|
||||
|
||||
A @deftech{fxvector} is like a @tech{vector}, but it holds only
|
||||
@tech{fixnums}. The only advantage of an @tech{fxvector} over a
|
||||
@tech{fixnums}. The only advantage of a @tech{fxvector} over a
|
||||
@tech{vector} is that a shared version can be created with functions
|
||||
like @racket[shared-fxvector].
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
The @racketmodname[racket/flonum] library provides operations like
|
||||
@racket[fl+] that consume and produce only
|
||||
@tech{flonums}. Flonum-specific operations provide can better
|
||||
@tech{flonums}. Flonum-specific operations can provide better
|
||||
performance when used consistently, and they are as safe as generic
|
||||
operations like @racket[+].
|
||||
|
||||
|
@ -71,7 +71,7 @@ Like @racket[round], @racket[floor], @racket[ceiling], and
|
|||
|
||||
Like @racket[sin], @racket[cos], @racket[tan], @racket[asin],
|
||||
@racket[acos], @racket[atan], @racket[log], @racket[exp], and
|
||||
@racket[flsqrt], but constrained to consume and produce
|
||||
@racket[sqrt], but constrained to consume and produce
|
||||
@tech{flonums}. The result is @racket[+nan.0] when a number outside
|
||||
the range @racket[-1.0] to @racket[1.0] is given to @racket[flasin] or
|
||||
@racket[flacos], or when a negative number is given to @racket[fllog]
|
||||
|
@ -113,9 +113,9 @@ unsafe operations on @tech{flvector}s (see
|
|||
unsafe operations on @tech{vectors} of inexact reals.
|
||||
|
||||
An f64vector as provided by @racketmodname[ffi/vector] stores the
|
||||
same kinds of values as an @tech{flvector}, but with extra
|
||||
same kinds of values as a @tech{flvector}, but with extra
|
||||
indirections that make f64vectors more convenient for working with
|
||||
foreign libraries. The lack of indirections make unsafe
|
||||
foreign libraries. The lack of indirections makes unsafe
|
||||
@tech{flvector} access more efficient.
|
||||
|
||||
Two @tech{flvectors} are @racket[equal?] if they have the same length,
|
||||
|
|
|
@ -183,7 +183,7 @@ result is the (single) result of @scheme[body]. If the
|
|||
|
||||
@defform[(for/last (for-clause ...) body ...+)]{ Iterates like
|
||||
@scheme[for], but the @scheme[for/last] result is the (single)
|
||||
result of of the last evaluation of @scheme[body]. If the
|
||||
result of the last evaluation of @scheme[body]. If the
|
||||
@scheme[body] is never evaluated, then the result of the
|
||||
@scheme[for/last] expression is @scheme[#f].
|
||||
|
||||
|
@ -291,7 +291,7 @@ identifiers. The right-hand side is of the form @scheme[(id . _rest)].
|
|||
The result can be either @scheme[#f], to indicate that the forms
|
||||
should not be treated specially (perhaps because the number of bound
|
||||
identifiers is inconsistent with the @scheme[(id . _rest)] form), or a
|
||||
new @scheme[_clause] to to replace the given one. The new clause might
|
||||
new @scheme[_clause] to replace the given one. The new clause might
|
||||
use @scheme[:do-in].}
|
||||
|
||||
@defform[(:do-in ([(outer-id ...) outer-expr] ...)
|
||||
|
@ -351,7 +351,7 @@ and bound to the corresponding @scheme[id]s. The @scheme[id]s are
|
|||
bound in all expressions within the form other than the
|
||||
@scheme[init-expr]s.
|
||||
|
||||
After the @scheme[id]s are bound, then @scheme[stop?-expr] is
|
||||
After the @scheme[id]s have been bound, the @scheme[stop?-expr] is
|
||||
evaluated. If it produces @scheme[#f], each @scheme[expr] is evaluated
|
||||
for its side-effect. The @scheme[id]s are then effectively updated
|
||||
with the values of the @scheme[step-expr]s, where the default
|
||||
|
|
|
@ -42,7 +42,7 @@ system and hardware---which rarely support, for example, the guarantee
|
|||
of sequential consistency that is provided for @racket[thread]-based
|
||||
concurrency. At the same time, operations that seem obviously safe may
|
||||
have a complex enough implementation internally that they cannot run
|
||||
in parallel. See also @guidesecref["effective-futures"].
|
||||
in parallel. See also @guidesecref["effective-futures"] in @|Guide|.
|
||||
|
||||
@deftogether[(
|
||||
@defproc[(future [thunk (-> any)]) future?]
|
||||
|
|
|
@ -376,7 +376,7 @@ constant time and atomically. If @scheme[hash] is created with
|
|||
(or/c #f exact-nonnegative-integer?)]{
|
||||
|
||||
Returns @scheme[#f] if @scheme[hash] contains no elements, otherwise
|
||||
it returns an integer that is a index to the first element in the hash
|
||||
it returns an integer that is an index to the first element in the hash
|
||||
table; ``first'' refers to an unspecified ordering of the table
|
||||
elements, and the index values are not necessarily consecutive
|
||||
integers. For a mutable @scheme[hash], this index is guaranteed to
|
||||
|
|
|
@ -213,7 +213,7 @@ In more detail, patterns match as follows:
|
|||
|
||||
@item{@racket[(_struct-id _pat ...)] or
|
||||
@racket[(#,(racketidfont "struct") _struct-id (_pat ...))] ---
|
||||
matches an instance of a structure type names
|
||||
matches an instance of a structure type named
|
||||
@racket[_struct-id], where each field in the instance matches
|
||||
the corresponding @racket[_pat]. See also @scheme[struct*].
|
||||
|
||||
|
@ -292,7 +292,7 @@ In more detail, patterns match as follows:
|
|||
can be duplicated once for each @racket[_pat]! Identifiers in
|
||||
@racket[_pat] are bound only in the corresponding copy of the
|
||||
result expression; in a module context, if the result
|
||||
expression refers to a binding, then that all @racket[_pat]s
|
||||
expression refers to a binding, then all @racket[_pat]s
|
||||
must include the binding.
|
||||
|
||||
@examples[
|
||||
|
@ -426,7 +426,7 @@ b
|
|||
@; ----------------------------------------
|
||||
|
||||
@defproc[(exn:misc:match? [v any/c]) boolean?]{
|
||||
A predicate for the exception raised by in the case of a match failure.
|
||||
A predicate for the exception raised in the case of a match failure.
|
||||
}
|
||||
|
||||
|
||||
|
@ -444,7 +444,7 @@ The first @racket[proc-expr] subexpression must evaluate to a
|
|||
Whenever @racket[id] appears as the beginning of a pattern, this
|
||||
transformer is given, at expansion time, a syntax object
|
||||
corresponding to the entire pattern (including @racket[id]). The
|
||||
pattern is the replaced with the result of the transformer.
|
||||
pattern is replaced with the result of the transformer.
|
||||
|
||||
A transformer produced by a second @racket[proc-expr] subexpression is
|
||||
used when @racket[id] is used in an expression context. Using the
|
||||
|
@ -466,7 +466,7 @@ default is @racket[equal?].}
|
|||
type named @racket[struct-id], where the field @racket[field] in the
|
||||
instance matches the corresponding @racket[pat].
|
||||
|
||||
Any field of @racket[struct-id] may be omitted and they may occur in any order.
|
||||
Any field of @racket[struct-id] may be omitted, and such fields can occur in any order.
|
||||
|
||||
@defexamples[
|
||||
#:eval match-eval
|
||||
|
|
|
@ -82,7 +82,7 @@ Returns a newly allocated @tech{mutable list} with the same elements as
|
|||
@defproc[(mlist->list [mlst mlist?]) list?]{
|
||||
|
||||
Returns a newly allocated @tech{mutable list} with the same elements as
|
||||
@racket[nlst].}
|
||||
@racket[mlst].}
|
||||
|
||||
|
||||
@defproc[(mlength [mlst mlist?])
|
||||
|
|
|
@ -110,7 +110,7 @@ because all numbers are @tech{complex numbers}.}
|
|||
@defproc[(rational? [v any/c]) boolean?]{ Returns @racket[#t] if
|
||||
@racket[v] is a @techlink{rational number}, @racket[#f] otherwise.
|
||||
|
||||
@mz-examples[(rational? 1) (rational? +inf.0) (real? "hello")]}
|
||||
@mz-examples[(rational? 1) (rational? +inf.0) (rational? "hello")]}
|
||||
|
||||
|
||||
@defproc[(integer? [v any/c]) boolean?]{ Returns @racket[#t] if @racket[v]
|
||||
|
@ -252,7 +252,7 @@ Returns the product of the @racket[z]s, multiplying pairwise from left
|
|||
[(/ [z number?] [w number?] ...+) number?])]{
|
||||
|
||||
When no @racket[w]s are supplied, returns @racket[(/ 1 z)].
|
||||
Otherwise, returns the division @racket[z] by the @racket[w]s working
|
||||
Otherwise, returns the division of @racket[z] by the @racket[w]s working
|
||||
pairwise from left to right.
|
||||
|
||||
If @racket[z] is exact @racket[0] and no @racket[w] is exact
|
||||
|
@ -387,7 +387,7 @@ Returns the smallest integer that is at least as large as
|
|||
|
||||
@defproc[(truncate [x real?]) integer?]{
|
||||
|
||||
Returns the integer farthest from @racket[0] that is no closer to
|
||||
Returns the integer farthest from @racket[0] that is not farther from
|
||||
@racket[0] than @racket[x].
|
||||
|
||||
@mz-examples[(truncate 17/4) (truncate -17/4) (truncate 2.5) (truncate -2.5)]}
|
||||
|
@ -395,7 +395,7 @@ Returns the integer farthest from @racket[0] that is no closer to
|
|||
|
||||
@defproc[(numerator [q rational?]) integer?]{
|
||||
|
||||
Coreces @racket[q] to an exact number, finds the numerator of the
|
||||
Coerces @racket[q] 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 @racket[q].
|
||||
|
||||
|
@ -404,7 +404,7 @@ Coreces @racket[q] to an exact number, finds the numerator of the
|
|||
|
||||
@defproc[(denominator [q rational?]) integer?]{
|
||||
|
||||
Coreces @racket[q] to an exact number, finds the numerator of the
|
||||
Coerces @racket[q] 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 @racket[q].
|
||||
|
||||
|
@ -415,7 +415,7 @@ Coreces @racket[q] to an exact number, finds the numerator of the
|
|||
|
||||
Among the real numbers within @racket[(abs tolerance)] of @racket[x],
|
||||
returns the one corresponding to an exact number whose
|
||||
@racket[denominator] is smallest. If multiple integers are within
|
||||
@racket[denominator] is the smallest. If multiple integers are within
|
||||
@racket[tolerance] of @racket[x], the one closest to @racket[0] is
|
||||
used.
|
||||
|
||||
|
@ -440,21 +440,21 @@ Among the real numbers within @racket[(abs tolerance)] of @racket[x],
|
|||
|
||||
|
||||
@defproc[(< [x real?] [y real?] ...+) boolean?]{ Returns @racket[#t] if
|
||||
the arguments in the given order are in strictly increasing,
|
||||
the arguments in the given order are strictly increasing,
|
||||
@racket[#f] otherwise.
|
||||
|
||||
@mz-examples[(< 1 1) (< 1 2 3) (< 1 +inf.0) (< 1 +nan.0)]}
|
||||
|
||||
|
||||
@defproc[(<= [x real?] [y real?] ...+) boolean?]{ Returns @racket[#t]
|
||||
if the arguments in the given order are in non-decreasing,
|
||||
if the arguments in the given order are non-decreasing,
|
||||
@racket[#f] otherwise.
|
||||
|
||||
@mz-examples[(<= 1 1) (<= 1 2 1)]}
|
||||
|
||||
|
||||
@defproc[(> [x real?] [y real?] ...+) boolean?]{ Returns @racket[#t] if
|
||||
the arguments in the given order are in strictly decreasing,
|
||||
the arguments in the given order are strictly decreasing,
|
||||
@racket[#f] otherwise.
|
||||
|
||||
@mz-examples[(> 1 1) (> 3 2 1) (> +inf.0 1) (< +nan.0 1)]}
|
||||
|
@ -556,7 +556,7 @@ Returns the tangent of @racket[z], where @racket[z] is in radians. The
|
|||
|
||||
@defproc[(asin [z number?]) number?]{
|
||||
|
||||
Returns the arcsin in radians of @racket[z]. The result is normally
|
||||
Returns the arcsine in radians of @racket[z]. The result is normally
|
||||
inexact, but it is exact @racket[0] if @racket[z] is exact @scheme[0].
|
||||
|
||||
@mz-examples[(asin 0.25) (asin 1+05.i)]}
|
||||
|
@ -746,7 +746,7 @@ both in binary and as integers.
|
|||
(current-pseudo-random-generator)])
|
||||
(and/c real? inexact? (>/c 0) (</c 1))])]{
|
||||
|
||||
When called with and integer argument @racket[k], returns a random
|
||||
When called with an integer argument @racket[k], returns a random
|
||||
exact integer in the range @racket[0] to @math{@racket[k]-1}. When
|
||||
called with zero arguments, returns a random inexact number between
|
||||
@racket[0] and @racket[1], exclusive.
|
||||
|
@ -827,7 +827,7 @@ generator.}
|
|||
@defproc[(number->string [z number?] [radix (or/c 2 8 10 16) 10])
|
||||
string?]{
|
||||
Returns a string that is the printed form of @racket[z]
|
||||
in the base specific by @racket[radix]. If @racket[z] is inexact,
|
||||
in the base specified by @racket[radix]. If @racket[z] is inexact,
|
||||
@racket[radix] must be @racket[10], otherwise the
|
||||
@exnraise[exn:fail:contract].
|
||||
|
||||
|
@ -841,7 +841,7 @@ Reads and returns a number datum from @racket[s] (see
|
|||
@secref["parse-number"]), returning @racket[#f] if @racket[s] does not
|
||||
parse exactly as a number datum (with no whitespace). The optional
|
||||
@racket[radix] argument specifies the default base for the number,
|
||||
which can be overriden by @litchar{#b}, @litchar{#o}, @litchar{#d}, or
|
||||
which can be overridden by @litchar{#b}, @litchar{#o}, @litchar{#d}, or
|
||||
@litchar{#x} in the string.
|
||||
|
||||
@mz-examples[(string->number "3.0+2.5i") (string->number "hello")
|
||||
|
@ -853,12 +853,12 @@ which can be overriden by @litchar{#b}, @litchar{#o}, @litchar{#d}, or
|
|||
|
||||
Prints @racket[n] into a string and returns the string. The printed
|
||||
form of @racket[n] shows exactly @racket[decimal-digits] digits after
|
||||
the decimal point. The printed for uses a minus sign if @racket[n] is
|
||||
the decimal point. The printed form uses a minus sign if @racket[n] is
|
||||
negative, and it does not use a plus sign if @racket[n] is positive.
|
||||
|
||||
Before printing, @racket[n] is converted to an exact number,
|
||||
multiplied by @racket[(expt 10 decimal-digits)], rounded, and then
|
||||
divided again by @racket[(expt 10 decimal-digits)]. The result of ths
|
||||
divided again by @racket[(expt 10 decimal-digits)]. The result of this
|
||||
process is an exact number whose decimal representation has no more
|
||||
than @racket[decimal-digits] digits after the decimal (and it is
|
||||
padded with trailing zeros if necessary).
|
||||
|
|
|
@ -136,7 +136,7 @@ package value as obtained by @racket[syntax-local-value] on an
|
|||
identifier that is bound to a package.
|
||||
|
||||
Given such an identifier, the @racket[package-exported-identifiers]
|
||||
function returns a list of identifiers that corresponding to the
|
||||
function returns a list of identifiers that correspond to the
|
||||
bindings that would be introduced by opening the package in the
|
||||
lexical context being expanded. The
|
||||
@racket[package-original-identifiers] function returns a parallel list
|
||||
|
|
|
@ -297,7 +297,7 @@ Similar to @scheme[map], except that
|
|||
elements of the @scheme[lst]s; and}
|
||||
|
||||
@item{the result is that of @scheme[proc] applied to the last elements
|
||||
of the @scheme[lsts]s; more specifically, the application of
|
||||
of the @scheme[lst]s; more specifically, the application of
|
||||
@scheme[proc] to the last elements in the @scheme[lst]s is in tail
|
||||
position with respect to the @scheme[andmap] call.}
|
||||
|
||||
|
@ -482,7 +482,7 @@ Returns @scheme[(remove* v-lst lst eqv?)].
|
|||
|
||||
Returns a list sorted according to the @scheme[less-than?] procedure,
|
||||
which takes two elements of @scheme[lst] and returns a true value if
|
||||
the first is less than (i.e., should be sorted earlier) than the
|
||||
the first is less than (i.e., should be sorted earlier) the
|
||||
second.
|
||||
|
||||
The sort is stable; if two elements of @scheme[lst] are ``equal''
|
||||
|
@ -558,7 +558,6 @@ Like @scheme[member], but finds an element using @scheme[eq?].
|
|||
(memq 2 (list 1 2 3 4))
|
||||
(memq 9 (list 1 2 3 4))
|
||||
]}
|
||||
}
|
||||
|
||||
|
||||
@defproc[(memf [proc procedure?] [lst list?])
|
||||
|
|
|
@ -79,20 +79,20 @@ argument:
|
|||
racket
|
||||
(provide place-main)
|
||||
|
||||
(define (place-main ch)
|
||||
(place-channel-send ch (format "Hello from place ~a"
|
||||
(place-channel-recv ch))))
|
||||
(define (place-main pch)
|
||||
(place-channel-send pch (format "Hello from place ~a"
|
||||
(place-channel-recv pch))))
|
||||
]
|
||||
|
||||
|
||||
@defproc[(place? [x any/c]) boolean?]{
|
||||
Returns @racket[#t] if @racket[x] is a @deftech{place descriptor}
|
||||
@defproc[(place? [v any/c]) boolean?]{
|
||||
Returns @racket[#t] if @racket[v] is a @deftech{place descriptor}
|
||||
value, @racket[#f] otherwise. Every @tech{place descriptor}
|
||||
is also a @tech{place channel}.
|
||||
}
|
||||
|
||||
@defproc[(place-channel? [x any/c]) boolean?]{
|
||||
Returns @racket[#t] if @racket[x] is @tech{place channel},
|
||||
@defproc[(place-channel? [v any/c]) boolean?]{
|
||||
Returns @racket[#t] if @racket[v] is @tech{place channel},
|
||||
@racket[#f] otherwise.
|
||||
}
|
||||
|
||||
|
@ -130,15 +130,15 @@ racket
|
|||
channel}).
|
||||
}
|
||||
|
||||
@defproc[(place-channel-send [ch place-channel?] [v any/c]) void]{
|
||||
Sends a message @racket[v] on channel @racket[ch].
|
||||
@defproc[(place-channel-send [pch place-channel?] [v any/c]) void]{
|
||||
Sends a message @racket[v] on channel @racket[pch].
|
||||
}
|
||||
|
||||
@defproc[(place-channel-recv [p place-channel?]) any/c]{
|
||||
Returns a message received on channel @racket[ch].
|
||||
@defproc[(place-channel-recv [pch place-channel?]) any/c]{
|
||||
Returns a message received on channel @racket[pch].
|
||||
}
|
||||
|
||||
@defproc[(place-channel-send/recv [ch place-channel?] [v any/c]) void]{
|
||||
Sends an immutable message @racket[v] on channel @racket[ch] and then
|
||||
@defproc[(place-channel-send/recv [pch place-channel?] [v any/c]) void]{
|
||||
Sends an immutable message @racket[v] on channel @racket[pch] and then
|
||||
waits for a reply message on the same channel.
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ as returned by @scheme[object-name] (and as printed for debugging) is
|
|||
The given @scheme[name] is used for printing an error message if the
|
||||
resulting procedure is applied to the wrong number of arguments. In
|
||||
addition, if @scheme[proc] is an @tech{accessor} or @tech{mutator}
|
||||
produced by @scheme[define-struct],
|
||||
produced by @scheme[struct],
|
||||
@scheme[make-struct-field-accessor], or
|
||||
@scheme[make-struct-field-mutator], the resulting procedure also uses
|
||||
@scheme[name] when its (first) argument has the wrong type. More
|
||||
|
@ -249,7 +249,7 @@ which must be sorted using @scheme[keyword<?]. If @scheme[allowed-kws]
|
|||
is @scheme[#f], then the resulting procedure still accepts any
|
||||
keyword, otherwise the keywords in @scheme[required-kws] must be a
|
||||
subset of those in @scheme[allowed-kws]. The original @scheme[proc]
|
||||
must require no more keywords than the ones listed din
|
||||
must require no more keywords than the ones listed in
|
||||
@scheme[required-kws], and it must allow at least the keywords in
|
||||
@scheme[allowed-kws] (or it must allow all keywords if
|
||||
@scheme[allowed-kws] is @scheme[#f]).
|
||||
|
@ -310,10 +310,10 @@ immutable (so that a property binding or immutable designation is
|
|||
redundant and disallowed).
|
||||
|
||||
@examples[
|
||||
(define-struct annotated-proc (base note)
|
||||
#:property prop:procedure
|
||||
(struct-field-index base))
|
||||
(define plus1 (make-annotated-proc
|
||||
(struct annotated-proc (base note)
|
||||
#:property prop:procedure
|
||||
(struct-field-index base))
|
||||
(define plus1 (annotated-proc
|
||||
(lambda (x) (+ x 1))
|
||||
"adds 1 to its argument"))
|
||||
(procedure? plus1)
|
||||
|
@ -344,14 +344,14 @@ Providing a procedure @scheme[proc-spec] argument to
|
|||
is disallowed).
|
||||
|
||||
@mz-examples[
|
||||
(define-struct fish (weight color)
|
||||
#:mutable
|
||||
#:property
|
||||
prop:procedure
|
||||
(lambda (f n)
|
||||
(let ([w (fish-weight f)])
|
||||
(set-fish-weight! f (+ n w)))))
|
||||
(define wanda (make-fish 12 'red))
|
||||
(struct fish (weight color)
|
||||
#:mutable
|
||||
#:property
|
||||
prop:procedure
|
||||
(lambda (f n)
|
||||
(let ([w (fish-weight f)])
|
||||
(set-fish-weight! f (+ n w)))))
|
||||
(define wanda (fish 12 'red))
|
||||
(fish? wanda)
|
||||
(procedure? wanda)
|
||||
(fish-weight wanda)
|
||||
|
@ -375,7 +375,7 @@ If @scheme[proc] is an instance of a structure type with property
|
|||
@scheme[prop:procedure], and if the property value indicates a field
|
||||
of the structure, and if the field value is a procedure, then
|
||||
@scheme[procedure-extract-target] returns the field value. Otherwise,
|
||||
the result if @scheme[#f].
|
||||
the result is @scheme[#f].
|
||||
|
||||
When a @scheme[prop:procedure] property value is a procedure, the
|
||||
procedure is @emph{not} returned by
|
||||
|
@ -400,14 +400,14 @@ Arity-mismatch reporting automatically uses
|
|||
property is not associated with a procedure structure type.
|
||||
|
||||
@examples[
|
||||
(define-struct evens (proc)
|
||||
(struct evens (proc)
|
||||
#:property prop:procedure (struct-field-index proc)
|
||||
#:property prop:arity-string
|
||||
(lambda (p)
|
||||
"an even number of arguments"))
|
||||
|
||||
(define pairs
|
||||
(make-evens
|
||||
(evens
|
||||
(case-lambda
|
||||
[() null]
|
||||
[(a b . more)
|
||||
|
|
|
@ -38,7 +38,7 @@ Note that the last @scheme[body] of this form must produce a single
|
|||
value, but the value can itself be a @scheme[delay] promise that
|
||||
returns multiple values.
|
||||
|
||||
The @scheme[lazy] form useful for implementing lazy libraries and
|
||||
The @scheme[lazy] form is useful for implementing lazy libraries and
|
||||
languages, where tail calls can be wrapped in a promise.}
|
||||
|
||||
|
||||
|
|
|
@ -71,17 +71,17 @@ The Unicode categories follow.
|
|||
@;------------------------------------------------------------------------
|
||||
@section{Additional Syntactic Constraints}
|
||||
|
||||
In addition to matching a grammars, regular expressions must meet two
|
||||
In addition to matching a grammar, regular expressions must meet two
|
||||
syntactic restrictions:
|
||||
|
||||
@itemize[
|
||||
|
||||
@item{In a @nonterm{repeat} other than @nonterm{atom}@litchar{?},
|
||||
then @nonterm{atom} must not match an empty sequence.}
|
||||
the @nonterm{atom} must not match an empty sequence.}
|
||||
|
||||
@item{In a @litchar{(?<=}@nonterm{regexp}@litchar{)} or
|
||||
@litchar{(?<!}@nonterm{regexp}@litchar{)},
|
||||
the @nonterm{regexp} must match a bounded sequence, only.}
|
||||
the @nonterm{regexp} must match a bounded sequence only.}
|
||||
|
||||
]
|
||||
|
||||
|
@ -646,7 +646,7 @@ like @racket[regexp-match/end].}
|
|||
|
||||
The complement of @racket[regexp-match*]: the result is a list of
|
||||
strings (if @racket[pattern] is a string or character regexp and
|
||||
@racket[input] is a string) or byte strings (otherwise) from in
|
||||
@racket[input] is a string) or byte strings (otherwise) from
|
||||
@racket[input] that are separated by matches to
|
||||
@racket[pattern]. Adjacent matches are separated with @racket[""] or
|
||||
@racket[#""]. Zero-length matches are treated the same as for
|
||||
|
@ -688,7 +688,7 @@ an end-of-file if @racket[input] is an input port).
|
|||
Performs a match using @racket[pattern] on @racket[input], and then
|
||||
returns a string or byte string in which the matching portion of
|
||||
@racket[input] is replaced with @racket[insert]. If @racket[pattern]
|
||||
matches no part of @racket[input], then @racket[iput] is returned
|
||||
matches no part of @racket[input], then @racket[input] is returned
|
||||
unmodified.
|
||||
|
||||
The @racket[insert] argument can be either a (byte) string, or a
|
||||
|
|
|
@ -22,7 +22,7 @@ can be used as events; see @secref["sync"].
|
|||
@defproc[(make-semaphore [init exact-nonnegative-integer? 0]) semaphore?]{
|
||||
|
||||
Creates and returns a new semaphore with the counter initially set to
|
||||
@scheme[init]. If @scheme[init-k] is larger than a semaphore's maximum
|
||||
@scheme[init]. If @scheme[init] is larger than a semaphore's maximum
|
||||
internal counter value, the @exnraise[exn:fail].}
|
||||
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ For most sequence types, extracting elements from a sequence has no
|
|||
side-effect on the original sequence value; for example, extracting the
|
||||
sequence of elements from a list does not change the list. For other
|
||||
sequence types, each extraction implies a side effect; for example,
|
||||
extracting the sequence of bytes from a port cause the bytes to be read
|
||||
extracting the sequence of bytes from a port causes the bytes to be read
|
||||
from the port.
|
||||
|
||||
Individual elements of a sequence typically correspond to single values,
|
||||
|
@ -163,7 +163,7 @@ in the sequence.
|
|||
Returns a sequence equivalent to @scheme[(in-port read-byte in)].}
|
||||
|
||||
@defproc[(in-input-port-chars [in input-port?]) sequence?]{
|
||||
Returns a sequence whose elements are read as characters form
|
||||
Returns a sequence whose elements are read as characters from
|
||||
@scheme[in] (equivalent to @scheme[(in-port read-char in)]).}
|
||||
|
||||
@defproc[(in-lines [in input-port? (current-input-port)]
|
||||
|
@ -244,8 +244,8 @@ in the sequence.
|
|||
@racket[stop] value is not included in the sequence); @scheme[stop]
|
||||
can be a predicate that is applied to the results of @racket[producer],
|
||||
or it can be a value that is tested against the result of
|
||||
with @scheme[eq?]. (You must use a predicate for @racket[stop]
|
||||
function if the stop value is itself a function or if
|
||||
with @scheme[eq?]. (The @racket[stop] argument must be a predicate
|
||||
if the stop value is itself a function or if
|
||||
@scheme[producer] returns multiple values.)}
|
||||
|
||||
@defproc[(in-value [v any/c]) sequence?]{
|
||||
|
@ -315,7 +315,7 @@ in the sequence.
|
|||
@item{The fifth result is like the fourth result, but it takes the
|
||||
current element value(s) instead of the current position.}
|
||||
@item{The sixth result is like the fourth result, but it takes both
|
||||
the current position and the current element values(s) and
|
||||
the current position and the current element value(s) and
|
||||
determines a sequence end after the current element is already
|
||||
included in the sequence.}]
|
||||
|
||||
|
@ -457,9 +457,9 @@ in the sequence.
|
|||
|
||||
@defproc[(stream-add-between [s sequence?] [e any/c])
|
||||
sequence?]{
|
||||
Returns a sequence whose elements are the elements of @scheme[s]
|
||||
except in between each is @scheme[e]. The new sequence is constructed
|
||||
lazily.}
|
||||
Returns a sequence whose elements are the elements of @scheme[s],
|
||||
but with @scheme[e] between each pair of elements in @racket[s].
|
||||
The new sequence is constructed lazily.}
|
||||
|
||||
@defproc[(stream-count [f procedure?] [s sequence?])
|
||||
exact-nonnegative-integer?]{
|
||||
|
@ -500,7 +500,7 @@ in the sequence.
|
|||
(g)
|
||||
(g)]
|
||||
|
||||
To use an existing generator as a sequence, you should use
|
||||
To use an existing generator as a sequence, use
|
||||
@scheme[in-producer] with a stop-value known for the generator.
|
||||
|
||||
@examples[#:eval generator-eval
|
||||
|
@ -518,7 +518,7 @@ in the sequence.
|
|||
|
||||
@defform[(infinite-generator body ...)]{
|
||||
Creates a function similar to @scheme[generator] but when the last
|
||||
@scheme[body] is executed the function will re-execute all the bodies
|
||||
@scheme[body] is evaluated, the function will re-evaluates all the bodies
|
||||
in a loop.
|
||||
|
||||
@examples[#:eval generator-eval
|
||||
|
|
|
@ -67,9 +67,9 @@ mutator bindings; see @secref["structinfo"]. A @scheme[_shell-id] must
|
|||
be one of the @scheme[id]s bound by the @scheme[shared] form to a
|
||||
@scheme[_shell-expr].
|
||||
|
||||
When the @scheme[expr]s of the @scheme[shared] form are parsed via
|
||||
When the @scheme[expr]s of the @scheme[shared] form are parsed as
|
||||
@scheme[_shared-expr] (taking into account the order of the variants
|
||||
for precedence), and sub-expressions that parse via
|
||||
for parsing precedence), the sub-expressions that were parsed via
|
||||
@scheme[_early-expr] will be evaluated first when the @scheme[shared]
|
||||
form is evaluated. Among such expressions, they are evaluated in the
|
||||
order as they appear within the @scheme[shared] form. However, any
|
||||
|
|
|
@ -143,9 +143,9 @@ contains the concatenated characters of the given @scheme[str]s. If no
|
|||
|
||||
|
||||
@defproc[(string->list [str string?]) (listof char?)]{ Returns a new
|
||||
list of characters coresponding to the content of @scheme[str]. That is,
|
||||
list of characters corresponding to the content of @scheme[str]. That is,
|
||||
the length of the list is @scheme[(string-length str)], and the
|
||||
sequence of characters of @scheme[str] are in the same sequence in the
|
||||
sequence of characters of @scheme[str] is the same sequence in the
|
||||
result list.
|
||||
|
||||
@mz-examples[(string->list "Apple")]}
|
||||
|
@ -325,12 +325,12 @@ allocated string).}
|
|||
|
||||
@defproc[(string-locale=? [str1 string?] [str2 string?] ...+)
|
||||
boolean?]{ Like @scheme[string=?], but the strings are compared in a
|
||||
locale-specific way, based the value of @scheme[current-locale]. See
|
||||
locale-specific way, based on the value of @scheme[current-locale]. See
|
||||
@secref["encodings"] for more information on locales.}
|
||||
|
||||
@defproc[(string-locale<? [str1 string?] [str2 string?] ...+) boolean?]{
|
||||
Like @scheme[string<?], but the sort order compares strings in a
|
||||
locale-specific way, based the value of @scheme[current-locale]. In
|
||||
locale-specific way, based on the value of @scheme[current-locale]. In
|
||||
particular, the sort order may not be simply a lexicographic
|
||||
extension of character ordering.}
|
||||
|
||||
|
@ -354,11 +354,11 @@ allocated string).}
|
|||
|
||||
@defproc[(string-locale-upcase [string string?]) string?]{ Like
|
||||
@scheme[string-upcase], but using locale-specific case-conversion
|
||||
rules based the value of @scheme[current-locale].}
|
||||
rules based on the value of @scheme[current-locale].}
|
||||
|
||||
@defproc[(string-locale-downcase [string string?]) string?]{ Like
|
||||
@scheme[string-downcase], but using locale-specific case-conversion
|
||||
rules based the value of @scheme[current-locale].
|
||||
rules based on the value of @scheme[current-locale].
|
||||
}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
|
|
@ -24,7 +24,7 @@ takes one value for each field of the structure type, except that some
|
|||
of the fields of a structure type can be @deftech{automatic fields};
|
||||
the @tech{automatic fields} are initialized to a constant that is
|
||||
associated with the structure type, and the corresponding arguments
|
||||
are omitted for the constructor procedure. All automatic fields in a
|
||||
are omitted from the constructor procedure. All automatic fields in a
|
||||
structure type follow the non-automatic fields.
|
||||
|
||||
A structure type can be created as a @pidefterm{structure subtype} of
|
||||
|
@ -124,7 +124,7 @@ are initialized with @racket[auto-v]. The total field count (including
|
|||
The @racket[props] argument is a list of pairs, where the @racket[car]
|
||||
of each pair is a structure type property descriptor, and the
|
||||
@racket[cdr] is an arbitrary value. A property can be specified
|
||||
multiple times in in @racket[props] (including properties that are
|
||||
multiple times in @racket[props] (including properties that are
|
||||
automatically added by properties that are directly included in
|
||||
@racket[props]) only if the associated values are @racket[eq?],
|
||||
otherwise the @exnraise[exn:fail:contract]. See @secref["structprops"]
|
||||
|
@ -577,13 +577,13 @@ encapsulated procedure must return):
|
|||
@itemize[
|
||||
|
||||
@item{an identifier that is bound to the structure type's descriptor,
|
||||
or @racket[#f] it none is known;}
|
||||
or @racket[#f] if none is known;}
|
||||
|
||||
@item{an identifier that is bound to the structure type's constructor,
|
||||
or @racket[#f] it none is known;}
|
||||
or @racket[#f] if none is known;}
|
||||
|
||||
@item{an identifier that is bound to the structure type's predicate,
|
||||
or @racket[#f] it none is known;}
|
||||
or @racket[#f] if none is known;}
|
||||
|
||||
@item{a list of identifiers bound to the field accessors of the
|
||||
structure type, optionally with @racket[#f] as the list's last
|
||||
|
@ -678,7 +678,7 @@ as @racket[make-struct-info].}
|
|||
@defthing[prop:struct-info struct-type-property?]{
|
||||
|
||||
The @tech{structure type property} for creating new structure types
|
||||
like @racket[struct:struct-info]. The property value must a procedure
|
||||
like @racket[struct:struct-info]. The property value must be a procedure
|
||||
of one argument that takes an instance structure and returns
|
||||
structure-type information in list form.}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ shape and properties of the result:
|
|||
|
||||
@item{If the result has a @scheme['certify-mode] property that is
|
||||
@indexed-scheme['transparent-binding], then the certificate
|
||||
is attached to similar to @scheme['transparent], but further
|
||||
is attached in a way similar to @scheme['transparent], but further
|
||||
treating the syntax object corresponding to the second list
|
||||
element as having a @scheme['transparent] value for the
|
||||
@scheme['certify-mode] property if it does not already have
|
||||
|
@ -119,7 +119,7 @@ expansion context:
|
|||
|
||||
@item{When the expander encounters a @scheme[quote-syntax] form, it
|
||||
attaches all accumulated @tech{active certificates} from the
|
||||
expressions's context to the quoted syntax objects. A certificate
|
||||
expression's context to the quoted syntax objects. A certificate
|
||||
for the enclosing module (if any) is also included. The
|
||||
certificates are attached as @tech{inactive certificates} to the
|
||||
immediate syntax object (i.e., not to any nested syntax
|
||||
|
|
|
@ -46,7 +46,7 @@ expansion.}
|
|||
|
||||
@defproc[(expand-once [top-level-form any/c]) syntax?]{
|
||||
|
||||
Partially expands @scheme[form-level-form] and returns a syntax object
|
||||
Partially expands @scheme[top-level-form] and returns a syntax object
|
||||
for the partially-expanded expression. Due to limitations in the
|
||||
expansion mechanism, some context information may be lost. In
|
||||
particular, calling @scheme[expand-once] on the result may produce a
|
||||
|
|
|
@ -238,7 +238,7 @@ to the symbols in @scheme[syms], where even further extension of the
|
|||
lexical information drops information for other symbols. In
|
||||
particular, transferring the lexical context via
|
||||
@scheme[datum->syntax] from the result of this function to a symbol
|
||||
other than one in @scheme[syms] produces a identifier with no binding.
|
||||
other than one in @scheme[syms] produces an identifier with no binding.
|
||||
|
||||
See also @scheme[quote-syntax/prune].}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ transformer. It is provided normally by
|
|||
|
||||
This procedure is intended for use in a transformer, where
|
||||
@scheme[id-stx] is an identifier bound to a @tech{syntax parameter}. The
|
||||
result is transformer that behaves as @scheme[id-stx], but that cannot
|
||||
result is a transformer that behaves as @scheme[id-stx], but that cannot
|
||||
be used with @scheme[syntax-parameterize] or
|
||||
@scheme[syntax-parameter-value].
|
||||
|
||||
|
@ -80,7 +80,7 @@ defining a procedure that calls a parameter. Such a procedure can be
|
|||
exported to others to allow access to the parameter value, but not to
|
||||
change the parameter value. Similarly,
|
||||
@scheme[make-parameter-rename-transformer] allows a @tech{syntax parameter}
|
||||
to used as a macro, but not changed.
|
||||
to be used as a macro, but not changed.
|
||||
|
||||
The result of @scheme[make-parameter-rename-transformer] is not
|
||||
treated specially by @scheme[syntax-local-value], unlike the result
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#lang scribble/doc
|
||||
@(require "mz.ss")
|
||||
|
||||
@(define lit-ellipses (scheme ...))
|
||||
@(define lit-ellipsis (scheme ...))
|
||||
|
||||
@(define syntax-eval
|
||||
(lambda ()
|
||||
|
@ -19,20 +19,20 @@
|
|||
id
|
||||
(pattern ...)
|
||||
(pattern ...+ . pattern)
|
||||
(pattern ... pattern ellipses pattern ...)
|
||||
(pattern ... pattern ellipses pattern ... . pattern)
|
||||
(pattern ... pattern ellipsis pattern ...)
|
||||
(pattern ... pattern ellipsis pattern ... . pattern)
|
||||
(code:line #,(tt "#")(pattern ...))
|
||||
(code:line #,(tt "#")(pattern ... pattern ellipses pattern ...))
|
||||
(code:line #,(tt "#")(pattern ... pattern ellipsis pattern ...))
|
||||
(code:line #,(tt "#s")(key-datum pattern ...))
|
||||
(code:line #,(tt "#s")(key-datum pattern ... pattern ellipses pattern ...))
|
||||
(ellipses stat-pattern)
|
||||
(code:line #,(tt "#s")(key-datum pattern ... pattern ellipsis pattern ...))
|
||||
(ellipsis stat-pattern)
|
||||
const]
|
||||
[stat-pattern id
|
||||
(stat-pattern ...)
|
||||
(stat-pattern ...+ . stat-pattern)
|
||||
(code:line #,(tt "#")(stat-pattern ...))
|
||||
const]
|
||||
[ellipses #,lit-ellipses])]{
|
||||
[ellipsis #,lit-ellipsis])]{
|
||||
|
||||
Finds the first @scheme[pattern] that matches the syntax object
|
||||
produced by @scheme[stx-expr], and for which the corresponding
|
||||
|
@ -72,7 +72,7 @@ A syntax object matches a @scheme[pattern] as follows:
|
|||
A @scheme[(pattern ...)] pattern matches a syntax object whose datum
|
||||
form (i.e., without lexical information) is a list with as many
|
||||
elements as sub-@scheme[pattern]s in the pattern, and where each
|
||||
syntax object that corresponding to an element of the list matches
|
||||
syntax object that corresponds to an element of the list matches
|
||||
the corresponding sub-@scheme[pattern].
|
||||
|
||||
Any @tech{pattern variables} bound by the sub-@scheme[pattern]s are
|
||||
|
@ -82,7 +82,7 @@ A syntax object matches a @scheme[pattern] as follows:
|
|||
|
||||
The last @scheme[pattern] must not be a @racket/form[(pattern ...)],
|
||||
@racket/form[(pattern ...+ . pattern)], @racket/form[(pattern ... pattern
|
||||
ellipses pattern ...)], or @racket/form[(pattern ... pattern ellipses
|
||||
ellipsis pattern ...)], or @racket/form[(pattern ... pattern ellipsis
|
||||
pattern ... . pattern)] form.
|
||||
|
||||
Like the previous kind of pattern, but matches syntax objects that
|
||||
|
@ -94,23 +94,23 @@ A syntax object matches a @scheme[pattern] as follows:
|
|||
@scheme[datum->syntax] coercion of the datum using the nearest
|
||||
enclosing syntax object's lexical context and source location).}
|
||||
|
||||
@specsubform[(pattern ... pattern ellipses pattern ...)]{
|
||||
@specsubform[(pattern ... pattern ellipsis pattern ...)]{
|
||||
|
||||
Like the @scheme[(pattern ...)] kind of pattern, but matching a
|
||||
syntax object with any number (zero or more) elements that match the
|
||||
sub-@scheme[pattern] followed by @scheme[ellipses] in the
|
||||
sub-@scheme[pattern] followed by @scheme[ellipsis] in the
|
||||
corresponding position relative to other sub-@scheme[pattern]s.
|
||||
|
||||
For each pattern variable bound by the sub-@scheme[pattern] followed
|
||||
by @scheme[ellipses], the larger pattern binds the same pattern
|
||||
by @scheme[ellipsis], the larger pattern binds the same pattern
|
||||
variable to a list of values, one for each element of the syntax
|
||||
object matched to the sub-@scheme[pattern], with an incremented
|
||||
@tech{depth marker}. (The sub-@scheme[pattern] itself may contain
|
||||
@scheme[ellipses], leading to a pattern variables bound to lists of
|
||||
@scheme[ellipsis], leading to a pattern variables bound to lists of
|
||||
lists of syntax objects with a @tech{depth marker} of @math{2}, and
|
||||
so on.)}
|
||||
|
||||
@specsubform[(pattern ... pattern ellipses pattern ... . pattern)]{
|
||||
@specsubform[(pattern ... pattern ellipsis pattern ... . pattern)]{
|
||||
|
||||
Like the previous kind of pattern, but with a final
|
||||
sub-@scheme[pattern] as for @scheme[(pattern ...+ . pattern)]. The
|
||||
|
@ -122,9 +122,9 @@ A syntax object matches a @scheme[pattern] as follows:
|
|||
Like a @scheme[(pattern ...)] pattern, but matching a vector syntax object
|
||||
whose elements match the corresponding sub-@scheme[pattern]s.}
|
||||
|
||||
@specsubform[(code:line #,(tt "#")(pattern ... pattern ellipses pattern ...))]{
|
||||
@specsubform[(code:line #,(tt "#")(pattern ... pattern ellipsis pattern ...))]{
|
||||
|
||||
Like a @scheme[(pattern ... pattern ellipses pattern ...)] pattern,
|
||||
Like a @scheme[(pattern ... pattern ellipsis pattern ...)] pattern,
|
||||
but matching a vector syntax object whose elements match the
|
||||
corresponding sub-@scheme[pattern]s.}
|
||||
|
||||
|
@ -135,13 +135,13 @@ A syntax object matches a @scheme[pattern] as follows:
|
|||
sub-@scheme[pattern]s. The @scheme[key-datum] must correspond to a
|
||||
valid first argument to @scheme[make-prefab-struct].}
|
||||
|
||||
@specsubform[(code:line #,(tt "#s")(key-datum pattern ... pattern ellipses pattern ...))]{
|
||||
@specsubform[(code:line #,(tt "#s")(key-datum pattern ... pattern ellipsis pattern ...))]{
|
||||
|
||||
Like a @scheme[(pattern ... pattern ellipses pattern ...)] pattern,
|
||||
Like a @scheme[(pattern ... pattern ellipsis pattern ...)] pattern,
|
||||
but matching a @tech{prefab} structure syntax object whose elements
|
||||
match the corresponding sub-@scheme[pattern]s.}
|
||||
|
||||
@specsubform[(ellipses stat-pattern)]{
|
||||
@specsubform[(ellipsis stat-pattern)]{
|
||||
|
||||
Matches the same as @scheme[stat-pattern], which is like a @scheme[pattern],
|
||||
but identifiers with the binding @scheme[...] are treated the same as
|
||||
|
@ -260,16 +260,16 @@ the individual @scheme[stx-expr].
|
|||
(template-elem ...+ . template)
|
||||
(code:line #,(tt "#")(template-elem ...))
|
||||
(code:line #,(tt "#s")(key-datum template-elem ...))
|
||||
(ellipses stat-template)
|
||||
(ellipsis stat-template)
|
||||
const]
|
||||
[template-elem (code:line template ellipses ...)]
|
||||
[template-elem (code:line template ellipsis ...)]
|
||||
[stat-template id
|
||||
(stat-template ...)
|
||||
(stat-template ... . stat-template)
|
||||
(code:line #,(tt "#")(stat-template ...))
|
||||
(code:line #,(tt "#s")(key-datum stat-template ...))
|
||||
const]
|
||||
[ellipses #,lit-ellipses])]{
|
||||
[ellipsis #,lit-ellipsis])]{
|
||||
|
||||
Constructs a syntax object based on a @scheme[template],which can
|
||||
inlude @tech{pattern variables} bound by @scheme[syntax-case] or
|
||||
|
@ -282,14 +282,14 @@ Template forms produce a syntax object as follows:
|
|||
If @scheme[id] is bound as a @tech{pattern variable}, then
|
||||
@scheme[id] as a template produces the @tech{pattern variable}'s
|
||||
match result. Unless the @scheme[id] is a sub-@scheme[template] that is
|
||||
replicated by @scheme[ellipses] in a larger @scheme[template], the
|
||||
replicated by @scheme[ellipsis] in a larger @scheme[template], the
|
||||
@tech{pattern variable}'s value must be a syntax object with a
|
||||
@tech{depth marker} of @math{0} (as opposed to a list of
|
||||
matches).
|
||||
|
||||
More generally, if the @tech{pattern variable}'s value has a depth
|
||||
marker @math{n}, then it can only appear within a template where it
|
||||
is replicated by at least @math{n} @scheme[ellipses]es. In that case,
|
||||
is replicated by at least @math{n} @scheme[ellipsis]es. In that case,
|
||||
the template will be replicated enough times to use each match result
|
||||
at least once.
|
||||
|
||||
|
@ -299,38 +299,38 @@ Template forms produce a syntax object as follows:
|
|||
@specsubform[(template-elem ...)]{
|
||||
|
||||
Produces a syntax object whose datum is a list, and where the
|
||||
elements of the list correspond to syntax objects producesd by the
|
||||
elements of the list correspond to syntax objects produced by the
|
||||
@scheme[template-elem]s.
|
||||
|
||||
A @scheme[template-elem] is a sub-@scheme[template] replicated by any
|
||||
number of @scheme[ellipses]es:
|
||||
number of @scheme[ellipsis]es:
|
||||
|
||||
@itemize[
|
||||
|
||||
@item{If the sub-@scheme[template] is replicated by no
|
||||
@scheme[ellipses]es, then it generates a single syntax object to
|
||||
@scheme[ellipsis]es, then it generates a single syntax object to
|
||||
incorporate into the result syntax object.}
|
||||
|
||||
@item{If the sub-@scheme[template] is replicated by one
|
||||
@scheme[ellipses], then it generates a sequence of syntax objects
|
||||
@scheme[ellipsis], then it generates a sequence of syntax objects
|
||||
that is ``inlined'' into the resulting syntax object.
|
||||
|
||||
The number of generated elements depends the values of
|
||||
The number of generated elements depends on the values of
|
||||
@tech{pattern variables} referenced within the
|
||||
sub-@scheme[template]. There must be at least one @tech{pattern
|
||||
variable} whose value is has a @tech{depth marker} less than the
|
||||
number of @scheme[ellipses]es after the pattern variable within the
|
||||
variable} whose value has a @tech{depth marker} less than the
|
||||
number of @scheme[ellipsis]es after the pattern variable within the
|
||||
sub-@scheme[template].
|
||||
|
||||
If a @tech{pattern variable} is replicated by more
|
||||
@scheme[ellipses]es in a @scheme[template] than the @tech{depth
|
||||
@scheme[ellipsis]es in a @scheme[template] than the @tech{depth
|
||||
marker} of its binding, then the @tech{pattern variable}'s result
|
||||
is determined normally for inner @scheme[ellipses]es (up to the
|
||||
is determined normally for inner @scheme[ellipsis]es (up to the
|
||||
binding's @tech{depth marker}), and then the result is replicated
|
||||
as necessary to satisfy outer @scheme[ellipses]es.}
|
||||
as necessary to satisfy outer @scheme[ellipsis]es.}
|
||||
|
||||
@item{For each @scheme[ellipses] after the first one, the preceding
|
||||
element (with earlier replicating @scheme[ellipses]s) is
|
||||
@item{For each @scheme[ellipsis] after the first one, the preceding
|
||||
element (with earlier replicating @scheme[ellipsis]es) is
|
||||
conceptually wrapped with parentheses for generating output, and
|
||||
then the wrapping parentheses are removed in the resulting syntax
|
||||
object.}]}
|
||||
|
@ -338,7 +338,7 @@ Template forms produce a syntax object as follows:
|
|||
@specsubform[(template-elem ... . template)]{
|
||||
|
||||
Like the previous form, but the result is not necessarily a list;
|
||||
instead, the place of the empty list in resulting syntax object's
|
||||
instead, the place of the empty list in the resulting syntax object's
|
||||
datum is taken by the syntax object produced by @scheme[template].}
|
||||
|
||||
@specsubform[(code:line #,(tt "#")(template-elem ...))]{
|
||||
|
@ -353,16 +353,16 @@ Template forms produce a syntax object as follows:
|
|||
The @scheme[key-datum] must correspond to a valid first argument of
|
||||
@scheme[make-prefab-struct].}
|
||||
|
||||
@specsubform[(ellipses stat-template)]{
|
||||
@specsubform[(ellipsis stat-template)]{
|
||||
|
||||
Produces the same result as @scheme[stat-template], which is like a
|
||||
@scheme[template], but @scheme[...] is treated like a @scheme[id]
|
||||
@scheme[template], but @scheme[...] is treated like an @scheme[id]
|
||||
(with no pattern binding).}
|
||||
|
||||
@specsubform[const]{
|
||||
|
||||
A @scheme[const] template is any form that does not match the
|
||||
preceding cases, and it produces the result @scheme[(quote-syntac
|
||||
preceding cases, and it produces the result @scheme[(quote-syntax
|
||||
const)].}
|
||||
|
||||
A @scheme[(#,(schemekeywordfont "syntax") template)] form is normally
|
||||
|
@ -383,12 +383,12 @@ substituted in place of the @scheme[unsyntax] or
|
|||
@scheme[unsyntax-splicing] form within the quasiquoting template, just
|
||||
like @scheme[unquote] and @scheme[unquote-splicing] within
|
||||
@scheme[quasiquote]. (If the escaped expression does not generate a
|
||||
syntax object, it is converted to one in the same was as for the
|
||||
right-hand sides of @scheme[with-syntax].) Nested
|
||||
syntax object, it is converted to one in the same way as for the
|
||||
right-hand side of @scheme[with-syntax].) Nested
|
||||
@scheme[quasisyntax]es introduce quasiquoting layers in the same way
|
||||
as nested @scheme[quasiquote]s.
|
||||
|
||||
Also analogous @scheme[quasiquote], the reader converts @litchar{#`}
|
||||
Also analogous to @scheme[quasiquote], the reader converts @litchar{#`}
|
||||
to @scheme[quasisyntax], @litchar{#,} to @scheme[unsyntax], and
|
||||
@litchar["#,@"] to @scheme[unsyntax-splicing]. See also
|
||||
@secref["parse-quote"].}
|
||||
|
@ -412,7 +412,7 @@ for use only with a @scheme[quasisyntax] template.}
|
|||
Like @scheme[syntax], except that the immediate resulting syntax
|
||||
object takes its source-location information from the result of
|
||||
@scheme[stx-expr] (which must produce a syntax object), unless the
|
||||
@scheme[template] is just a pattern variable or both the source and
|
||||
@scheme[template] is just a pattern variable, or both the source and
|
||||
position of @scheme[stx-expr] are @scheme[#f].}
|
||||
|
||||
|
||||
|
@ -475,21 +475,21 @@ Equivalent to
|
|||
@defidform[...]{
|
||||
|
||||
The @scheme[...] transformer binding prohibits @scheme[...] from
|
||||
being used as an expression. This binding useful only in syntax
|
||||
being used as an expression. This binding is useful only in syntax
|
||||
patterns and templates, where it indicates repetitions of a pattern or
|
||||
template. See @scheme[syntax-case] and @scheme[syntax].}
|
||||
|
||||
@defidform[_]{
|
||||
|
||||
The @scheme[_] transformer binding prohibits @scheme[_] from being
|
||||
used as an expression. This binding useful only in syntax patterns,
|
||||
used as an expression. This binding is useful only in syntax patterns,
|
||||
where it indicates a pattern that matches any syntax object. See
|
||||
@scheme[syntax-case].}
|
||||
|
||||
|
||||
@defproc[(syntax-pattern-variable? [v any/c]) boolean?]{
|
||||
|
||||
Return @scheme[#t] if @scheme[v] is a value that, as a
|
||||
Returns @scheme[#t] if @scheme[v] is a value that, as a
|
||||
transformer-binding value, makes the bound variable as pattern
|
||||
variable in @scheme[syntax] and other forms. To check whether an
|
||||
identifier is a pattern variable, use @scheme[syntax-local-value] to
|
||||
|
|
|
@ -70,9 +70,9 @@ Racket adds properties to expanded syntax (often using
|
|||
immutable list of identifiers from the disappeared bindings, as a
|
||||
@indexed-racket['disappeared-binding] property.}
|
||||
|
||||
@item{When a subtyping @racket[define-struct] form is expanded, the
|
||||
@item{When a subtyping @racket[struct] form is expanded, the
|
||||
identifier used to reference the base type does not appear in the
|
||||
expansion. Therefore, the @racket[define-struct] transformer adds the
|
||||
expansion. Therefore, the @racket[struct] transformer adds the
|
||||
identifier to the expansion result as a
|
||||
@indexed-racket['disappeared-use] property.}
|
||||
|
||||
|
@ -81,7 +81,7 @@ Racket adds properties to expanded syntax (often using
|
|||
@secref["stxcerts"]), the @indexed-racket['protected] property is
|
||||
added to the identifier with a @racket[#t] value.}
|
||||
|
||||
@item{When or @racket[read-syntax] or @racket[read-honu-syntax]
|
||||
@item{When @racket[read-syntax] or @racket[read-honu-syntax]
|
||||
generates a syntax object, it attaches a property to the object
|
||||
(using a private key) to mark the object as originating from a
|
||||
read. The @racket[syntax-original?] predicate looks for the property
|
||||
|
|
|
@ -74,7 +74,7 @@ between @scheme[0] (inclusive) and the number of non-automatic fields
|
|||
in the structure type (exclusive, not counting supertype fields), and
|
||||
the designated field must also be specified as immutable.
|
||||
|
||||
If the property value is an procedure of one argument, then the
|
||||
If the property value is a procedure of one argument, then the
|
||||
procedure serves as a @tech{syntax transformer} and for @scheme[set!]
|
||||
transformations. If the property value is a procedure of two
|
||||
arguments, then the first argument is the structure whose type has
|
||||
|
@ -82,7 +82,7 @@ arguments, then the first argument is the structure whose type has
|
|||
syntax object as for a @tech{syntax transformer} and for @scheme[set!]
|
||||
transformations; @scheme[set!-transformer-procedure] applied to the
|
||||
structure produces a new function that accepts just the syntax object
|
||||
and call the procedure associated through the property. Finally, if the
|
||||
and calls the procedure associated through the property. Finally, if the
|
||||
property value is an integer, the target identifier is extracted from
|
||||
the structure instance; if the field value is not a procedure of one
|
||||
argument, then a procedure that always calls
|
||||
|
@ -205,7 +205,7 @@ also added to the expansion result (because the expansion might
|
|||
introduce bindings or references to internal-definition bindings).
|
||||
|
||||
Expansion of @scheme[stx] can use certificates for the expression
|
||||
already being expanded (see @secref["stxcerts"]) , and @tech{inactive
|
||||
already being expanded (see @secref["stxcerts"]), and @tech{inactive
|
||||
certificates} associated with @scheme[stx] are activated for
|
||||
@scheme[stx] (see @secref["stxcerts"]). Furthermore, if the
|
||||
transformer is defined within a module (i.e., the current expansion
|
||||
|
@ -347,7 +347,7 @@ Binds each identifier in @scheme[id-list] within the
|
|||
@scheme[expr] when the identifiers correspond to
|
||||
@scheme[define-values] bindings, and supply a compile-time expression
|
||||
when the identifiers correspond to @scheme[define-syntaxes] bindings;
|
||||
the later case, the number of values produced by the expression should
|
||||
the latter case, the number of values produced by the expression should
|
||||
match the number of identifiers, otherwise the
|
||||
@exnraise[exn:fail:contract:arity].
|
||||
|
||||
|
@ -379,7 +379,7 @@ contexts, for example), then the resulting identifier is given a
|
|||
@tech{syntax mark} to simulate a non-existent lexical context. The
|
||||
@scheme[intdef-ctx] argument can be a list because removing
|
||||
internal-definition contexts one at a time can produce a different
|
||||
intermediate binding then removing them all at once.}
|
||||
intermediate binding than removing them all at once.}
|
||||
|
||||
|
||||
@defproc[(syntax-local-value [id-stx syntax?]
|
||||
|
@ -436,7 +436,7 @@ transformer augmented with certificates from @scheme[id-stx]. If
|
|||
results are the value that @scheme[syntax-local-value] would produce
|
||||
and @scheme[#f].
|
||||
|
||||
If @scheme[id-stx] has no transformer biding, then
|
||||
If @scheme[id-stx] has no transformer binding, then
|
||||
@scheme[failure-thunk] is called (and it can return any number of
|
||||
values), or an exception is raised if @scheme[failure-thunk] is
|
||||
@scheme[#f].}
|
||||
|
@ -554,7 +554,7 @@ an @tech{expression context}, a @tech{top-level context}, a
|
|||
@tech{module context}, or a @tech{module-begin context}.
|
||||
|
||||
A list result indicates expansion in an @tech{internal-definition
|
||||
context}. The identity of the lists's first element (i.e., its
|
||||
context}. The identity of the list's first element (i.e., its
|
||||
@scheme[eq?]ness) reflects the identity of the internal-definition
|
||||
context; in particular two transformer expansions receive the same
|
||||
first value if and only if they are invoked for the same
|
||||
|
@ -607,7 +607,7 @@ lexical information of the current @tech{module context} (if any)
|
|||
added.
|
||||
|
||||
Thus, the result is an identifier corresponding to the innermost
|
||||
shadowing of @scheme[id-stx] in the current context if its shadowed,
|
||||
shadowing of @scheme[id-stx] in the current context if it is shadowed,
|
||||
and a module-contextless version of @scheme[id-stx] otherwise.
|
||||
|
||||
@transform-time[]}
|
||||
|
@ -719,7 +719,7 @@ its rename-transformer chain has no binding.
|
|||
@defproc[(syntax-local-transforming-module-provides?) boolean?]{
|
||||
|
||||
Returns @scheme[#t] while a @tech{provide transformer} is running (see
|
||||
@scheme[make-provide-transformer]) or while a @schemeidfont{expand} sub-form of
|
||||
@scheme[make-provide-transformer]) or while an @schemeidfont{expand} sub-form of
|
||||
@scheme[#%provide] is expanded, @scheme[#f] otherwise.}
|
||||
|
||||
|
||||
|
@ -871,7 +871,7 @@ into a module.
|
|||
@item{@scheme[mod-path-stx] --- a @tech{module path} (relative
|
||||
to the importing module) for the source of the imported binding.}
|
||||
|
||||
@item{@scheme[mode] --- the @tech{phase level} shift the import.}
|
||||
@item{@scheme[mode] --- the @tech{phase level} shift of the import.}
|
||||
|
||||
]}
|
||||
|
||||
|
@ -904,7 +904,7 @@ of symbols representing the export modes specified by enclosing
|
|||
|
||||
If the derived form contains a sub-form that is a
|
||||
@scheme[_provide-spec], then it can call @scheme[expand-export] to
|
||||
transform the sub-@scheme[_provide-spec] to a lists of exports.
|
||||
transform the sub-@scheme[_provide-spec] to a list of exports.
|
||||
|
||||
See also @scheme[define-provide-syntax], which supports macro-style
|
||||
@scheme[provide] transformers.
|
||||
|
|
|
@ -34,9 +34,9 @@ surrogate class, and a surrogate interface.
|
|||
The host mixin adds one additional field, @scheme[surrogate], to its
|
||||
argument. It also adds a getter method, @scheme[get-surrogate], and a
|
||||
setter method, @scheme[set-surrogate], for changing the field. The
|
||||
@scheme[set-surrogate] form accepts instances the class returned by
|
||||
the form or @scheme[#f], and updates the field with its
|
||||
argument. Then, it calls the @scheme[on-disable-surrogate] on the
|
||||
@scheme[set-surrogate] method accepts instances of the class returned by
|
||||
the @racket[surrogate] form or @scheme[#f], and it updates the field with its
|
||||
argument; then, @scheme[set-surrogate] calls the @scheme[on-disable-surrogate] on the
|
||||
previous value of the field and @scheme[on-enable-surrogate] for the
|
||||
new value of the field. The @scheme[get-surrogate] method returns the
|
||||
current value of the field.
|
||||
|
|
|
@ -65,8 +65,8 @@ appears twice). When this source is parsed in a typical
|
|||
|
||||
A @deftech{top-level binding} is a @tech{binding} from a definition at
|
||||
the top-level; a @deftech{module binding} is a binding from a
|
||||
definition in a module; and a @deftech{local binding} is another other
|
||||
kind of binding. There is no difference between an @deftech{unbound}
|
||||
definition in a module; all other bindings are @deftech{local bindings}.
|
||||
There is no difference between an @deftech{unbound}
|
||||
identifier and one with a @tech{top-level binding}; within a module,
|
||||
references to @tech{top-level bindings} are disallowed, and so such
|
||||
identifiers are called @tech{unbound} in a module context.
|
||||
|
@ -112,7 +112,7 @@ A @deftech{syntax object} combines a simpler Racket value, such as a
|
|||
symbol or pair, with @deftech{lexical information} about bindings,
|
||||
source-location information, @tech{syntax properties}, and
|
||||
@tech{syntax certificates}. In particular, an @tech{identifier} is
|
||||
represented as a symbol object that combines a symbol and lexical and
|
||||
represented as a symbol object that combines a symbol with lexical and
|
||||
other information.
|
||||
|
||||
For example, a @racketidfont{car} @tech{identifier} might have
|
||||
|
@ -127,12 +127,12 @@ When a @tech{syntax object} represents a more complex expression than
|
|||
an @tech{identifier} or simple constant, its internal components can
|
||||
be extracted. Even for extracted identifier, detailed information
|
||||
about binding is available mostly indirectly; two identifiers can be
|
||||
compared to see if they refer to the same binding (i.e.,
|
||||
compared to determine whether they refer to the same binding (i.e.,
|
||||
@racket[free-identifier=?]), or whether each identifier would bind the
|
||||
other if one was in a binding position and the other in an expression
|
||||
other if one were in a binding position and the other in an expression
|
||||
position (i.e., @racket[bound-identifier=?]).
|
||||
|
||||
For example, the when the program written as
|
||||
For example, when the program written as
|
||||
|
||||
@racketblock[(let ([x 5]) (+ x 6))]
|
||||
|
||||
|
@ -397,7 +397,7 @@ core syntactic forms are encountered:
|
|||
|
||||
@item{When a @racket[require] form is encountered at the top level or
|
||||
module level, all lexical information derived from the top
|
||||
level or the specific module's level are extended with bindings
|
||||
level or the specific module's level is extended with bindings
|
||||
from the specified modules. If not otherwise indicated in the
|
||||
@racket[require] form, bindings are introduced at the
|
||||
@tech{phase level}s specified by the exporting modules:
|
||||
|
@ -467,7 +467,7 @@ For example, in
|
|||
]
|
||||
|
||||
the binding introduced for @racket[x] applies to the @racket[x] in the
|
||||
body, but not the @racket[y] n the body, because (at the point in
|
||||
body, but not the @racket[y] in the body, because (at the point in
|
||||
expansion where the @racket[let-values] form is encountered) the
|
||||
binding @racket[x] and the body @racket[y] are not
|
||||
@racket[bound-identifier=?].
|
||||
|
@ -485,7 +485,7 @@ the @tech{base environment}).
|
|||
|
||||
The @tech{value} for the binding is obtained by evaluating the
|
||||
expression in the @racket[define-syntaxes] form. This expression must
|
||||
be @tech{expand}ed (i.e. parsed) before it can be evaluated, and it is
|
||||
be @tech{expand}ed (i.e., parsed) before it can be evaluated, and it is
|
||||
expanded at @tech{phase level} 1 (i.e., in the @tech{transformer
|
||||
environment}) instead of @tech{phase level} 0.
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
@title[#:tag "syntax" #:style 'toc]{Syntactic Forms}
|
||||
|
||||
This section describes the core syntax forms that appear in a fully
|
||||
expanded expression, plus a many closely-related non-core forms.
|
||||
expanded expression, plus many closely related non-core forms.
|
||||
See @secref["fully-expanded"] for the core grammar.
|
||||
|
||||
@local-table-of-contents[]
|
||||
|
@ -413,7 +413,7 @@ bindings of each @racket[require-spec] are visible for expanding later
|
|||
|
||||
@specsubform[#:literals (for-meta)
|
||||
(for-meta phase-level require-spec ...)]{Like the combination of
|
||||
@racket[require-spec]s, but constrained each binding specified by
|
||||
@racket[require-spec]s, but the binding specified by
|
||||
each @racket[require-spec] is shifted by @racket[phase-level]. The
|
||||
@tech{label phase level} corresponds to @racket[#f], and a shifting
|
||||
combination that involves @racket[#f] produces @racket[#f].
|
||||
|
@ -1292,7 +1292,7 @@ A @tech{variable reference} can be used with
|
|||
@racket[variable-reference->resolved-module-path], and
|
||||
@racket[variable-reference->namespace], but facilities like
|
||||
@racket[define-namespace-anchor] and
|
||||
@racket[namespace-anchor->namespace] wrap those to provide an clearer
|
||||
@racket[namespace-anchor->namespace] wrap those to provide a clearer
|
||||
interface. A @tech{variable reference} is also useful to low-level
|
||||
extensions; see @other-manual['(lib
|
||||
"scribblings/inside/inside.scrbl")].}
|
||||
|
@ -1502,7 +1502,7 @@ exceptions, not the result of @racket[procedure-arity].}
|
|||
(id ...+ . rest-id)
|
||||
rest-id])]{
|
||||
|
||||
Produces a procedure. Each @racket[[forms body ...+]]
|
||||
Produces a procedure. Each @racket[[formals body ...+]]
|
||||
clause is analogous to a single @racket[lambda] procedure; applying
|
||||
the @racket[case-lambda]-generated procedure is the same as applying a
|
||||
procedure that corresponds to one of the clauses---the first procedure
|
||||
|
@ -1841,7 +1841,7 @@ respect to the original @racket[and] form.
|
|||
If no @racket[expr]s are provided, then result is @racket[#f].
|
||||
|
||||
If a single @racket[expr] is provided, then it is in tail position, so
|
||||
the results of the @racket[and] expression are the results of the
|
||||
the results of the @racket[or] expression are the results of the
|
||||
@racket[expr].
|
||||
|
||||
Otherwise, the first @racket[expr] is evaluated. If it produces a
|
||||
|
@ -1930,7 +1930,7 @@ defined as follows:
|
|||
|
||||
In an @tech{internal-definition context} (see @secref["intdef-body"]),
|
||||
a @racket[define] form introduces a local binding.
|
||||
At the top level, the top-level binding @racket[id] is created after
|
||||
At the top level, the top-level binding for @racket[id] is created after
|
||||
evaluating @racket[expr], if it does not exist already, and the
|
||||
top-level mapping of @racket[id] (in the @techlink{namespace} linked
|
||||
with the compiled definition) is set to the binding at the same time.
|
||||
|
@ -2287,7 +2287,7 @@ x
|
|||
|
||||
Assuming that all @racket[id]s refer to variables, this form evaluates
|
||||
@racket[expr], which must produce as many values as supplied
|
||||
@racket[id]s. The location of each @racket[id] is filled wih to the
|
||||
@racket[id]s. The location of each @racket[id] is filled with the
|
||||
corresponding value from @racket[expr] in the same way as for
|
||||
@racket[set!].
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ ignored until breaks are re-enabled (see @secref["breakhandler"]).}
|
|||
Causes the current thread to sleep until at least @racket[secs]
|
||||
seconds have passed after it starts sleeping. A zero value for
|
||||
@racket[secs] simply acts as a hint to allow other threads to
|
||||
execute. The value of @racket[secs] can be non-integral to request a
|
||||
execute. The value of @racket[secs] can be a non-integer to request a
|
||||
sleep duration to any precision; the precision of the actual sleep
|
||||
time is unspecified.}
|
||||
|
||||
|
@ -242,7 +242,7 @@ asynchronous channel.
|
|||
Queues @racket[v] as a message to @racket[thd] without blocking. If
|
||||
the message is queued, the result is @|void-const|. If @racket[thd]
|
||||
stops running---as in @racket[thread-running?]---before the message is
|
||||
queued, then @racket[fail-thunk] is called (through a tail call) if is
|
||||
queued, then @racket[fail-thunk] is called (through a tail call) if it is
|
||||
a procedure to produce the result, or @racket[#f] is returned if
|
||||
@racket[fail-thunk] is @racket[#f].}
|
||||
|
||||
|
@ -261,7 +261,7 @@ or returns @racket[#f] immediately if no message is available.}
|
|||
|
||||
Returns a constant @tech{synchronizable event} (see @secref["sync"])
|
||||
that becomes ready when the synchronizing thread has a message to
|
||||
receive. The event result is itself.}
|
||||
receive. The event result is the event itself.}
|
||||
|
||||
@defproc[(thread-rewind-receive [lst list?]) void?]{
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ ways:
|
|||
@item{@scheme[(rename sig-spec (id id) ...)] as an import binds the
|
||||
same as @scheme[sig-spec], except that the first @scheme[id] is used
|
||||
for the binding instead of the second @scheme[id] (where
|
||||
@scheme[sig-spec] by itself must imply a bindingthat is
|
||||
@scheme[sig-spec] by itself must imply a binding that is
|
||||
@scheme[bound-identifier=?] to second @scheme[id]). As an export,
|
||||
this form causes a definition for the first @scheme[id] to satisfy
|
||||
the export named by the second @scheme[id] in @scheme[sig-spec].}
|
||||
|
@ -134,7 +134,7 @@ export must explicitly use the tag.
|
|||
|
||||
A unit is prohibited syntactically from importing two signatures that
|
||||
are not distinct, unless they have different tags; two signatures are
|
||||
@defterm{distinct} only if when they share no ancestor through
|
||||
@defterm{distinct} only if they share no ancestor through
|
||||
@scheme[extends]. The same syntactic constraint applies to exported
|
||||
signatures. In addition, a unit is prohibited syntactically from
|
||||
importing the same identifier twice (after renaming and other
|
||||
|
@ -191,7 +191,7 @@ of bindings for import or export:
|
|||
exporting the signature.}
|
||||
|
||||
@item{Each @scheme[define-syntaxes] form in a signature declaration
|
||||
introduces a macro to that is available for use in any unit that
|
||||
introduces a macro that is available for use in any unit that
|
||||
imports the signature. Free variables in the definition's
|
||||
@scheme[expr] refer to other identifiers in the signature first, or
|
||||
the context of the @scheme[define-signature] form if the signature
|
||||
|
@ -233,7 +233,7 @@ of bindings for import or export:
|
|||
|
||||
]
|
||||
|
||||
When a @scheme[define-signature] form includes a @scheme[extends]
|
||||
When a @scheme[define-signature] form includes an @scheme[extends]
|
||||
clause, then the define signature automatically includes everything in
|
||||
the extended signature. Furthermore, any implementation of the new
|
||||
signature can be used as an implementation of the extended signature.}
|
||||
|
@ -271,7 +271,7 @@ unit's imports, the @scheme[invoke-unit] expression must contain a
|
|||
has no imports, the @scheme[import] clause can be omitted.
|
||||
|
||||
When no @scheme[tagged-sig-spec]s are provided, @scheme[unit-expr]
|
||||
must produce a unit that expect no imports. To invoke the unit, all
|
||||
must produce a unit that expects no imports. To invoke the unit, all
|
||||
bindings are first initialized to the @|undefined-const| value. Next,
|
||||
the unit's body definitions and expressions are evaluated in order; in
|
||||
the case of a definition, evaluation sets the value of the
|
||||
|
@ -300,7 +300,7 @@ The unit produced by @scheme[unit-expr] is linked and invoked as for
|
|||
@scheme[invoke-unit]. In addition, the @scheme[export] clause is
|
||||
treated as a kind of import into the local definition context. That
|
||||
is, for every binding that would be available in a unit that used the
|
||||
@scheme[export] clauses's @scheme[tagged-sig-spec] as an import, a
|
||||
@scheme[export] clause's @scheme[tagged-sig-spec] as an import, a
|
||||
definition is generated for the context of the
|
||||
@scheme[define-values/invoke-unit] form.}
|
||||
|
||||
|
@ -336,7 +336,7 @@ unit. Outside the compound unit, these imports behave as for a plain
|
|||
unit; inside the compound unit, they are propagated to some of the
|
||||
linked units. The @scheme[export] clause determines the exports of the
|
||||
compound unit. Again, outside the compound unit, these exports are
|
||||
trested the same as for a plain unit; inside the compound unit, they
|
||||
treated the same as for a plain unit; inside the compound unit, they
|
||||
are drawn from the exports of the linked units. Finally, the left-hand
|
||||
and right-hand parts of each declaration in the @scheme[link] clause
|
||||
specify how the compound unit's imports and exports are propagated to
|
||||
|
@ -347,7 +347,7 @@ available within the compound unit. Instead, imports and exports are
|
|||
connected at the level of whole signatures. Each specific import or
|
||||
export (i.e., an instance of some signature, possibly tagged) is given
|
||||
a @scheme[link-id] name. Specifically, a @scheme[link-id] is bound by
|
||||
the @scheme[import] clause or the left-hand part of an declaration in
|
||||
the @scheme[import] clause or the left-hand part of a declaration in
|
||||
the @scheme[link] clause. A bound @scheme[link-id] is referenced in
|
||||
the right-hand part of a declaration in the @scheme[link] clause or by
|
||||
the @scheme[export] clause.
|
||||
|
@ -398,7 +398,7 @@ evaluated.}
|
|||
Binds @scheme[unit-id] to both a unit and static information about the
|
||||
unit.
|
||||
|
||||
Evaluating a reference to an @scheme[unit-id] bound by
|
||||
Evaluating a reference to a @scheme[unit-id] bound by
|
||||
@scheme[define-unit] produces a unit, just like evaluating an
|
||||
@scheme[id] bound by @scheme[(define id (unit ...))]. In addition,
|
||||
however, @scheme[unit-id] can be used in @scheme[compound-unit/infer].
|
||||
|
@ -449,7 +449,7 @@ on static information associated with each
|
|||
@scheme[unit-id]. Links and exports can be inferred when all
|
||||
signatures exported by the linked units are distinct from each other
|
||||
and from all imported signatures, and when all imported signatures are
|
||||
distinct. Two signatures are @defterm{distinct} only if when they
|
||||
distinct. Two signatures are @defterm{distinct} only if they
|
||||
share no ancestor through @scheme[extends].
|
||||
|
||||
The long form of a @scheme[link] declaration can be used to resolve
|
||||
|
@ -525,7 +525,7 @@ current context. If given a link form containing multiple
|
|||
|
||||
Like @scheme[define-values/invoke-unit], but uses static information
|
||||
associated with @scheme[unit-id] to infer which imports must be
|
||||
assembled from the current context and what exports should be bound
|
||||
assembled from the current context and which exports should be bound
|
||||
by the definition. If given a link form containing multiple
|
||||
@scheme[link-unit-id]s, then the units are first linked via
|
||||
@scheme[define-compound-unit/infer].}
|
||||
|
@ -579,7 +579,7 @@ the enclosing environment, and like @scheme[define-unit], in that
|
|||
|
||||
Similar to @scheme[unit], except the body of the unit is determined by
|
||||
an existing unit produced by @scheme[unit-expr]. The result is a unit
|
||||
that whose implementation is @scheme[unit-expr], but whose imports,
|
||||
whose implementation is @scheme[unit-expr], but whose imports,
|
||||
exports, and initialization dependencies are as in the
|
||||
@scheme[unit/new-import-export] form (instead of as in the unit
|
||||
produced by @scheme[unit-expr]).
|
||||
|
@ -714,7 +714,7 @@ variables in the same signature, and then to the context of the
|
|||
...)
|
||||
([sig-spec-block (tagged-sig-spec [id contract] ...)
|
||||
tagged-sig-spec])]{
|
||||
The @scheme[define-unit/contract] form defines an unit compatible with
|
||||
The @scheme[define-unit/contract] form defines a unit compatible with
|
||||
link inference whose imports and exports are contracted with a unit
|
||||
contract. The unit name is used for the positive blame of the contract.}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user