Several typos from Jussi Salmela. Fixes PR 11790 -- all typos.

(Two issues remain that will be resolved later.)
This commit is contained in:
Eli Barzilay 2011-03-11 06:38:07 -05:00
parent a18197ff25
commit 5a9d954f2a
12 changed files with 48 additions and 43 deletions

View File

@ -19,7 +19,7 @@ many kinds of values, notably strings and lists, each @racket[_datum]
is typically a number, symbol, or boolean. is typically a number, symbol, or boolean.
Multiple @racket[_datum]s can be supplied for each clause, and the Multiple @racket[_datum]s can be supplied for each clause, and the
corresponding @racket[_expr] is evaluated of any of the corresponding @racket[_expr] is evaluated if any of the
@racket[_datum]s match. @racket[_datum]s match.
@examples[ @examples[

View File

@ -213,7 +213,7 @@ put the optional ones in the second section.
A function defined with @racket[case-lambda] might impose different A function defined with @racket[case-lambda] might impose different
constraints on its arguments depending on how many are provided. For constraints on its arguments depending on how many are provided. For
example, a @racket[report-cost] function might convert either a pair example, a @racket[report-cost] function might convert either a pair
or numbers or a string into a new string: of numbers or a string into a new string:
@margin-note{See @secref["case-lambda"] for an introduction to @margin-note{See @secref["case-lambda"] for an introduction to
@racket[case-lambda].} @racket[case-lambda].}
@ -297,7 +297,7 @@ section of the reference manual. They simplify contracts tremendously
and make them more accessible to potential clients. and make them more accessible to potential clients.
} }
Going back to the back-account example, suppose that we generalize the Going back to the bank-account example, suppose that we generalize the
module to support multiple accounts and that we also include a module to support multiple accounts and that we also include a
withdrawal operation. The improved bank-account module includes a withdrawal operation. The improved bank-account module includes a
@racket[account] structure type and the following functions: @racket[account] structure type and the following functions:

View File

@ -201,7 +201,7 @@ values to flow in both directions.
@ctc-section{Experimenting with Contracts and Modules} @ctc-section{Experimenting with Contracts and Modules}
All of the contracts and module in this chapter (excluding those just All of the contracts and modules in this chapter (excluding those just
following) are written using the standard @tt{#lang} syntax for following) are written using the standard @tt{#lang} syntax for
describing modules. Since modules serve as the boundary between describing modules. Since modules serve as the boundary between
parties in a contract, examples involve multiple modules. parties in a contract, examples involve multiple modules.

View File

@ -174,7 +174,7 @@ racket
(define (balance) amount) (define (balance) amount)
] ]
This module define an @racket[amount?] function as uses it as a This module defines an @racket[amount?] function and uses it as a
contract within @racket[->] contracts. When a client calls the contract within @racket[->] contracts. When a client calls the
@racket[deposit] function as exported with the contract @racket[(-> @racket[deposit] function as exported with the contract @racket[(->
amount? any)], it must supply an exact, nonnegative integer, otherwise amount? any)], it must supply an exact, nonnegative integer, otherwise
@ -293,8 +293,7 @@ racket
(code:comment "convert an amount (natural number) of cents") (code:comment "convert an amount (natural number) of cents")
(code:comment "into a dollar based string") (code:comment "into a dollar based string")
[format-nat (-> natural-number/c [format-nat (-> natural-number/c
(and/c string? (and/c string? #rx"[0-9]*\\.[0-9][0-9]"))])
#rx"[0-9]*\\.[0-9][0-9][0-9]"))])
] ]
@; ------------------------------------------------------------------------ @; ------------------------------------------------------------------------
@ -328,7 +327,7 @@ describes functions that accept other functions as its input. If a
server exports a function @racket[twice] with this contract and the server exports a function @racket[twice] with this contract and the
@racket[twice] is applied to a value other than a function of one @racket[twice] is applied to a value other than a function of one
argument, then the client is to blame. If @racket[twice] is applied to argument, then the client is to blame. If @racket[twice] is applied to
a function of one argument and @racket[twice] calls the give function a function of one argument and @racket[twice] calls the given function
on a value other than an integer, then the server is to blame. on a value other than an integer, then the server is to blame.
@; ---------------------------------------------------------------------- @; ----------------------------------------------------------------------

View File

@ -262,7 +262,7 @@ Here are some examples using each:
] ]
Overall, @racket[print] as corresponds to the expression layer of Overall, @racket[print] corresponds to the expression layer of
Racket syntax, @racket[write] corresponds to the reader layer, and Racket syntax, @racket[write] corresponds to the reader layer, and
@racket[display] roughly corresponds to the character layer. @racket[display] roughly corresponds to the character layer.
@ -294,7 +294,9 @@ After using @racket[write], as opposed to @racket[display] or
(read in) (read in)
(write #hash((a . "apple") (b . "banana")) out) (write #hash((a . "apple") (b . "banana")) out)
(read in) (read in)
(write '("alphabet" soup) out) (print '("alphabet" soup) out)
(read in)
(display '("alphabet" soup) out)
(read in) (read in)
] ]
@ -315,7 +317,7 @@ Other structure types created by @racket[struct], which offer
more abstraction than @tech{prefab} structure types, normally more abstraction than @tech{prefab} structure types, normally
@racket[write] either using @racketresultfont{#<....>} notation (for @racket[write] either using @racketresultfont{#<....>} notation (for
opaque structure types) or using @racketresultfont{#(....)} vector opaque structure types) or using @racketresultfont{#(....)} vector
notation (for transparent structure types). In neither can can the notation (for transparent structure types). In neither can the
result be read back in as an instance of the structure type: result be read back in as an instance of the structure type:
@interaction[ @interaction[

View File

@ -105,7 +105,7 @@ identifier and a default value:
[arg-id default-expr]]) [arg-id default-expr]])
]{} ]{}
A argument of the form @racket[[arg-id default-expr]] is An argument of the form @racket[[arg-id default-expr]] is
optional. When the argument is not supplied in an application, optional. When the argument is not supplied in an application,
@racket[_default-expr] produces the default value. The @racket[_default-expr] produces the default value. The
@racket[_default-expr] can refer to any preceding @racket[_arg-id], @racket[_default-expr] can refer to any preceding @racket[_arg-id],

View File

@ -117,12 +117,12 @@ list loops.
Racket provides a general @defterm{list comprehension} form Racket provides a general @defterm{list comprehension} form
@racket[for/list], which builds a list by iterating through @racket[for/list], which builds a list by iterating through
@defterm{sequences}. List comprehensions and related iteration forms @defterm{sequences}. List comprehensions and related iteration forms
are described in see @secref["for"]. are described in @secref["for"].
@;------------------------------------------------------------------------ @;------------------------------------------------------------------------
@section{List Iteration from Scratch} @section{List Iteration from Scratch}
Although @racket[map] and other iteration functions predefined, they Although @racket[map] and other iteration functions are predefined, they
are not primitive in any interesting sense. You can write equivalent are not primitive in any interesting sense. You can write equivalent
iterations using a handful of list primitives. iterations using a handful of list primitives.

View File

@ -115,4 +115,4 @@ Equivalently, the @racket[prefix-in] could be applied before
@racket[except-in], as long as the omission with @racket[except-in] is @racket[except-in], as long as the omission with @racket[except-in] is
specified using the @racket[m:] prefix: specified using the @racket[m:] prefix:
@racketblock[(require (except-in (prefix m: 'm) m:ghost))] @racketblock[(require (except-in (prefix-in m: 'm) m:ghost))]

View File

@ -132,7 +132,7 @@ to adjust its value:
(and (not (equal? lokation "here")) (and (not (equal? lokation "here"))
(not (equal? lokation "there")))) (not (equal? lokation "there"))))
(set! location "on a bus") (set! lokation "on a bus")
(would-ya-could-ya?) (would-ya-could-ya?)
] ]

View File

@ -139,14 +139,19 @@ effectively cancels one layer of @racket[unquote] and
or @racket[unquote-splicing] is needed. or @racket[unquote-splicing] is needed.
@examples[ @examples[
(eval:alts (#,qq (1 2 (#,qq (#,uq (+ 1 2) (eval:alts (#,qq (1 2 (#,qq (#,uq (+ 1 2)))))
(#,uq (#,uq (- 5 1)))))))
`(1 2 (,(string->uninterned-symbol "quasiquote") `(1 2 (,(string->uninterned-symbol "quasiquote")
(,(string->uninterned-symbol "unquote") (+ 1 2)) (,(string->uninterned-symbol "unquote") (+ 1 2)))))
(,(string->uninterned-symbol "unquote") 4)))) (eval:alts (#,qq (1 2 (#,qq (#,uq (#,uq (+ 1 2))))))
`(1 2 (,(string->uninterned-symbol "quasiquote")
(,(string->uninterned-symbol "unquote") 3))))
(eval:alts (#,qq (1 2 (#,qq ((#,uq (+ 1 2)) (#,uq (#,uq (- 5 1)))))))
`(1 2 (,(string->uninterned-symbol "quasiquote")
((,(string->uninterned-symbol "unquote") (+ 1 2))
(,(string->uninterned-symbol "unquote") 4)))))
] ]
The evaluation above will not actually print as shown. Instead, the The evaluations above will not actually print as shown. Instead, the
shorthand form of @racket[quasiquote] and @racket[unquote] will be shorthand form of @racket[quasiquote] and @racket[unquote] will be
used: @litchar{`} (i.e., a backquote) and @litchar{,} (i.e., a comma). used: @litchar{`} (i.e., a backquote) and @litchar{,} (i.e., a comma).
The same shorthands can be used in expressions: The same shorthands can be used in expressions:

View File

@ -383,7 +383,7 @@ supported are
@item{@litchar{[:upper:]} --- ASCII upper-case letters} @item{@litchar{[:upper:]} --- ASCII upper-case letters}
@item{@litchar{[:word:]} --- ASCII same as @litchar{\w}} @item{@litchar{[:word:]} --- ASCII letters and @litchar{_}, same as @litchar{\w}}
@item{@litchar{[:xdigit:]} --- ASCII hex digits} @item{@litchar{[:xdigit:]} --- ASCII hex digits}
@ -581,15 +581,6 @@ no problem doing so:
"billions and millions") "billions and millions")
] ]
The following example corrects doubled words:
@interaction[
(regexp-replace* #px"(\\S+) \\1"
(string-append "now is the the time for all good men to "
"to come to the aid of of the party")
"\\1")
]
The following example marks all immediately repeating patterns in a The following example marks all immediately repeating patterns in a
number string: number string:
@ -599,6 +590,15 @@ number string:
"{\\1,\\1}") "{\\1,\\1}")
] ]
The following example corrects doubled words:
@interaction[
(regexp-replace* #px"\\b(\\S+) \\1\\b"
(string-append "now is the the time for all good men to "
"to come to the aid of of the party")
"\\1")
]
@subsection{Non-capturing Clusters} @subsection{Non-capturing Clusters}
It is often required to specify a cluster (typically for It is often required to specify a cluster (typically for
@ -893,15 +893,14 @@ three dots separating them.
#:eval ex-eval #:eval ex-eval
(define ip-re1 (define ip-re1
(string-append (string-append
"^" (code:comment @#,t{nothing before}) "^" (code:comment @#,t{nothing before})
n0-255 (code:comment @#,t{the first @racket[n0-255],}) n0-255 (code:comment @#,t{the first @racket[n0-255],})
"(?:" (code:comment @#,t{then the subpattern of}) "(?:" (code:comment @#,t{then the subpattern of})
"\\." (code:comment @#,t{a dot followed by}) "\\." (code:comment @#,t{a dot followed by})
n0-255 (code:comment @#,t{an @racket[n0-255],}) n0-255 (code:comment @#,t{an @racket[n0-255],})
")" (code:comment @#,t{which is}) ")" (code:comment @#,t{which is})
"{3}" (code:comment @#,t{repeated exactly 3 times}) "{3}" (code:comment @#,t{repeated exactly 3 times})
"$" (code:comment @#,t{with nothing following}) "$")) (code:comment @#,t{with nothing following})
))
] ]
Let's try it out: Let's try it out:

View File

@ -18,7 +18,7 @@ For any sequence of characters, exactly one corresponding symbol is
@defterm{interned}; calling the @racket[string->symbol] procedure, or @defterm{interned}; calling the @racket[string->symbol] procedure, or
@racket[read]ing a syntactic identifier, produces an interned @racket[read]ing a syntactic identifier, produces an interned
symbol. Since interned symbols can be cheaply compared with symbol. Since interned symbols can be cheaply compared with
@racket[eq?] (and thus @racket[eqv?] or @racket[equal?]), they serves @racket[eq?] (and thus @racket[eqv?] or @racket[equal?]), they serve
as a convenient values to use for tags and enumerations. as a convenient values to use for tags and enumerations.
Symbols are case-sensitive. By using a @racketfont{#ci} prefix or in Symbols are case-sensitive. By using a @racketfont{#ci} prefix or in