typos
svn: r11390
This commit is contained in:
parent
896757cf1f
commit
dfac6998fa
|
@ -125,7 +125,7 @@ arguments: @scheme[char?]. }
|
||||||
|
|
||||||
We all know that @scheme[+] in Beginner Scheme is a function
|
We all know that @scheme[+] in Beginner Scheme is a function
|
||||||
that consumes at least two numbers but, in principle,
|
that consumes at least two numbers but, in principle,
|
||||||
arbitraily many more. Defining the function is easy:
|
arbitrarily many more. Defining the function is easy:
|
||||||
@schemeblock[
|
@schemeblock[
|
||||||
(define (plus fst snd . rst)
|
(define (plus fst snd . rst)
|
||||||
(foldr + (+ fst snd) rst))
|
(foldr + (+ fst snd) rst))
|
||||||
|
@ -159,7 +159,7 @@ rest argument follows @scheme[#:rest]
|
||||||
Since the remainder of the actual arguments are collected
|
Since the remainder of the actual arguments are collected
|
||||||
in a list for a rest parameter such as @scheme[rst], the
|
in a list for a rest parameter such as @scheme[rst], the
|
||||||
contract demands a list of values; in this specific
|
contract demands a list of values; in this specific
|
||||||
examples, these values must be number.
|
examples, these values must be numbers.
|
||||||
|
|
||||||
@ctc-section[#:tag "keywords"]{Keyword Arguments}
|
@ctc-section[#:tag "keywords"]{Keyword Arguments}
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ Then, informally, the proper precondition for @scheme[withdraw] is that
|
||||||
``the balance of the given account is greater than or equal to the given (withdrawal) amount.''
|
``the balance of the given account is greater than or equal to the given (withdrawal) amount.''
|
||||||
The postcondition is similar to the one for
|
The postcondition is similar to the one for
|
||||||
@ctc-link["flat-named-contracts"]{@scheme[deposit]}:
|
@ctc-link["flat-named-contracts"]{@scheme[deposit]}:
|
||||||
``the balance of the resulting account is larger than (or equal to) than the one of the
|
``the balance of the resulting account is larger than (or equal to) the one of the
|
||||||
given account.''
|
given account.''
|
||||||
You could of course also formulate a full-fledged correctness condition, namely,
|
You could of course also formulate a full-fledged correctness condition, namely,
|
||||||
that the balance of the resulting account is equal to the balance of the given
|
that the balance of the resulting account is equal to the balance of the given
|
||||||
|
@ -319,7 +319,7 @@ conditions we just discussed:
|
||||||
scheme
|
scheme
|
||||||
|
|
||||||
(code:comment "section 1: the contract definitions")
|
(code:comment "section 1: the contract definitions")
|
||||||
(define-struct account (balance))
|
(define-struct account (balance) #:mutable)
|
||||||
(define amount natural-number/c)
|
(define amount natural-number/c)
|
||||||
|
|
||||||
(define msg> "account a with balance larger than ~a expected")
|
(define msg> "account a with balance larger than ~a expected")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user