From bad81f8bcda9f5e592487468d174f456a2a6d82d Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 14 Oct 2008 00:13:12 +0000 Subject: [PATCH] small edits to contract docs svn: r12028 --- .../guide/contracts-simple-function.scrbl | 2 +- collects/scribblings/guide/contracts.scrbl | 5 +++-- collects/scribblings/reference/contracts.scrbl | 14 ++++++-------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/collects/scribblings/guide/contracts-simple-function.scrbl b/collects/scribblings/guide/contracts-simple-function.scrbl index 3287200c86..dff45ca2d9 100644 --- a/collects/scribblings/guide/contracts-simple-function.scrbl +++ b/collects/scribblings/guide/contracts-simple-function.scrbl @@ -276,7 +276,7 @@ scheme ] -@ctc-section[#:tag "coercion"]{Contracts coerced from other values} +@ctc-section[#:tag "coercion"]{Contracts Coerced from Other Values} The contract library treates a number of Scheme values as if they are contracts directly. We've already seen one main use of that: predicates. Every diff --git a/collects/scribblings/guide/contracts.scrbl b/collects/scribblings/guide/contracts.scrbl index 49b872a0d3..b72183307b 100644 --- a/collects/scribblings/guide/contracts.scrbl +++ b/collects/scribblings/guide/contracts.scrbl @@ -6,8 +6,9 @@ @title[#:tag "contracts" #:style 'toc]{Contracts} This chapter provides a gentle introduction to PLT Scheme's -contract system. For the complete details see the -@refsecref["contracts"] section in the reference manual. +contract system. + +@refdetails["contracts"]{contracts} @local-table-of-contents[] diff --git a/collects/scribblings/reference/contracts.scrbl b/collects/scribblings/reference/contracts.scrbl index 3df14cd5cb..8ef4d88a3e 100644 --- a/collects/scribblings/reference/contracts.scrbl +++ b/collects/scribblings/reference/contracts.scrbl @@ -4,10 +4,7 @@ @title[#:tag "contracts" #:style 'toc]{Contracts} -This chapter is long on detail and short on the motivation -and pragmatics of using contracts. See -@guidesecref["contracts"] in the Guide for more of the -latter and less of the former. +@guideintro["contracts"]{contracts} The contract system guards one part of a program from another. Programmers specify the behavior of a module exports via @@ -16,13 +13,13 @@ constraints. @deftech{Contracts} come in two forms: those constructed by the various operations listed in this section of the manual, and various -ordinary Scheme values double as contracts, including +ordinary Scheme values that double as contracts, including @itemize{ @item{@tech{symbols}, @tech{booleans}, @tech{characters}, and @scheme[null], which are treated as contracts that recognize themselves, using @scheme[eq?], } -@item{@tech{strings} and @tech{bytes strings}, which are treated as contracts +@item{@tech{strings} and @tech{byte strings}, which are treated as contracts that recognize themselves using @scheme[equal?], } @item{@tech{numbers}, which are treated as contracts @@ -30,7 +27,7 @@ that recognize themselves using @scheme[=],} @item{@tech{regular expressions}, which are treated as contracts that recognize @tech{byte strings} and @tech{strings} that match the regular expression, and } -@item{predicates: any procedure whose arity is 1 is treated as a +@item{predicates: any procedure of arity 1 is treated as a predicate. During contract checking, it is applied to the values that appear and should return @scheme[#f] to indicate that the contract failed, and anything else to indicate it passed.} @@ -1002,7 +999,8 @@ checked immediately (unlike, say, a function contract). For example, @scheme[flat-contract] constructs flat contracts from predicates, and -symbols, booleans, numbers, and other ordinary Scheme values are also +symbols, booleans, numbers, and other ordinary Scheme values +(that are defined as @tech{contracts}) are also flat contracts.} @defproc[(flat-contract-predicate [v flat-contract?])