doc typo and style corrections
svn: r16020
This commit is contained in:
parent
8b290c8ad2
commit
e447bc743f
|
@ -12,16 +12,16 @@ protect abstractions, ensuring that clients of your module
|
|||
cannot depend on the precise representation choices you make
|
||||
for your data structures.
|
||||
|
||||
@ctc-section{Getting started, with a stack example}
|
||||
@ctc-section{Getting Started, with a Stack Example}
|
||||
|
||||
@margin-note{
|
||||
You can type @scheme[#:exists] instead of @scheme[#:∃] if you
|
||||
cannot easily type unicode characters; in DrScheme, typing
|
||||
@tt{\exists} followed by either alt-\ or control-\ (depending
|
||||
on your platform) will produce @scheme[∃].}.
|
||||
on your platform) will produce @scheme[∃].}
|
||||
The @scheme[provide/contract] form allows you to write
|
||||
@schemeblock[#:∃ name-of-a-new-contract] as one of its clauses. This declaration
|
||||
introduces the variable @scheme[name-of-a-new-contract], binding it to a new
|
||||
@schemeblock[#:∃ _name-of-a-new-contract] as one of its clauses. This declaration
|
||||
introduces the variable @scheme[_name-of-a-new-contract], binding it to a new
|
||||
contract that hides information about the values it protects.
|
||||
|
||||
As an example, consider this (simple) implementation of a stack datastructure:
|
||||
|
|
|
@ -52,7 +52,7 @@ the @scheme[eq?] call would return @scheme[#t].
|
|||
|
||||
Moral: do not use @scheme[eq?] on values that have contracts.
|
||||
|
||||
@ctc-section[#:tag "exists-gotcha"]{Exists contracts and predicates}
|
||||
@ctc-section[#:tag "exists-gotcha"]{Exists Contracts and Predicates}
|
||||
|
||||
Much like the @scheme[eq?] example above, @scheme[#:∃] contracts
|
||||
can change the behavior of a program.
|
||||
|
@ -73,7 +73,7 @@ but where predicates signal errors when given @scheme[#:∃] contracts.
|
|||
Moral: do not use predicates on @scheme[#:∃] contracts, but if you're not sure, use
|
||||
@schememodname[scheme/exists] to be safe.
|
||||
|
||||
@ctc-section{Defining recursive contracts}
|
||||
@ctc-section{Defining Recursive Contracts}
|
||||
|
||||
When defining a self-referential contract, it is natural to use
|
||||
@scheme[define]. For example, one might try to write a contract on
|
||||
|
|
|
@ -194,7 +194,7 @@ something. This kind of thing happens when a module exports
|
|||
a function, an object, a class or other values that enable
|
||||
values to flow in both directions.
|
||||
|
||||
@ctc-section{Experimenting with examples}
|
||||
@ctc-section{Experimenting with Examples}
|
||||
|
||||
All of the contracts and module in this chapter (excluding those just
|
||||
following) are written using the standard @tt{#lang} syntax for
|
||||
|
|
|
@ -305,7 +305,7 @@ sequence; if no more elements are available, the
|
|||
|
||||
@section{Iterator Generators}
|
||||
@defmodule[scheme/generator]
|
||||
@defform[(generator body ...)]{ Create a function that returns a
|
||||
@defform[(generator body ...)]{ Creates a function that returns a
|
||||
value, usually through @scheme[yield], each time it is invoked. When
|
||||
the generator runs out of values to yield the last value it computed
|
||||
will be returned for future invocations of the generator. Generators
|
||||
|
@ -326,7 +326,7 @@ can be safely nested.
|
|||
(g)
|
||||
]
|
||||
|
||||
To use an existing generator as a sequence you should use @scheme[in-producer]
|
||||
To use an existing generator as a sequence, you should use @scheme[in-producer]
|
||||
with a stop-value known to the generator.
|
||||
|
||||
@examples[#:eval (generator-eval)
|
||||
|
@ -343,10 +343,10 @@ with a stop-value known to the generator.
|
|||
i)
|
||||
]}
|
||||
|
||||
@defproc[(in-generator [expr any?] ...) sequence?]{ Return a generator
|
||||
that can be used as a sequence. @scheme[in-generator] takes care of the
|
||||
case when @scheme[expr] stops producing values so when the @scheme[expr]
|
||||
completes the generator will end.
|
||||
@defproc[(in-generator [expr any?] ...) sequence?]{ Returns a generator
|
||||
that can be used as a sequence. The @scheme[in-generator] procedure takes care of the
|
||||
case when @scheme[expr] stops producing values, so when the @scheme[expr]
|
||||
completes, the generator will end.
|
||||
|
||||
@examples[#:eval (generator-eval)
|
||||
(for/list ([i (in-generator
|
||||
|
@ -357,6 +357,6 @@ completes the generator will end.
|
|||
i)
|
||||
]}
|
||||
|
||||
@defform[(yield expr)]{ Save the point of execution inside a generator
|
||||
and return a value.}
|
||||
@defform[(yield expr)]{ Saves the point of execution inside a generator
|
||||
and returns a value.}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user