fixed scheme{}

svn: r13592
This commit is contained in:
Matthias Felleisen 2009-02-15 01:41:18 +00:00
parent f302dbfb91
commit 80bad96d24

View File

@ -307,14 +307,14 @@ Second, we must translate the "world" actions---the arrows in the above
;; deal with the passing of time ;; deal with the passing of time
(define (tick w) ...) (define (tick w) ...)
;; click : @tech{D} @scheme{Number} @scheme{Number} @tech{MouseEvent} -> @tech{D} ;; click : @tech{D} @scheme[Number] @scheme[Number] @tech{MouseEvent} -> @tech{D}
;; deal with a mouse click at (x,y) of kind @scheme{me} ;; deal with a mouse click at (x,y) of kind @scheme[me]
;; in the current world @scheme{w} ;; in the current world @scheme[w]
(define (click w x y me) ...) (define (click w x y me) ...)
;; control : @tech{D} @tech{KeyEvent} -> @tech{D} ;; control : @tech{D} @tech{KeyEvent} -> @tech{D}
;; deal with a key event (symbol, char) @scheme{ke} ;; deal with a key event (symbol, char) @scheme[ke]
;; in the current world @scheme{w} ;; in the current world @scheme[w]
(define (control w ke) ...) (define (control w ke) ...)
)) ))
@ -357,9 +357,9 @@ Now that we have a data definition, we must also decide which computer
function that simulates time. For the other three arrows, we could use function that simulates time. For the other three arrows, we could use
either keyboard events or mouse clicks or both. Our solution uses three either keyboard events or mouse clicks or both. Our solution uses three
keystrokes: keystrokes:
@scheme{#\u} for unlocking the door, @scheme[#\u] for unlocking the door,
@scheme{#\l} for locking it, and @scheme[#\l] for locking it, and
@scheme{#\space} for pushing it open. @scheme[#\space] for pushing it open.
We can express these choices graphically by translating the above "state We can express these choices graphically by translating the above "state
machine" from the world of information into the world of data: machine" from the world of information into the world of data:
@ -372,17 +372,17 @@ Our analysis and data definition leaves us with three functions to design:
@itemize[ @itemize[
@item{@scheme{automatic-closer}, which closes the time during one tick;} @item{@scheme[automatic-closer], which closes the time during one tick;}
@item{@scheme{door-actions}, which manipulates the time in response to @item{@scheme[door-actions], which manipulates the time in response to
pressing a key; and} pressing a key; and}
@item{@scheme{render}, which translates the current state of the door into @item{@scheme[render], which translates the current state of the door into
a visible scene.} a visible scene.}
] ]
Let's start with @scheme{automatic-closer}. We know its contract and it is Let's start with @scheme[automatic-closer]. We know its contract and it is
easy to refine the purpose statement, too: easy to refine the purpose statement, too:
@(begin @(begin
@ -490,15 +490,15 @@ this purpose:
@(begin @(begin
#reader scribble/comment-reader #reader scribble/comment-reader
(schemeblock (schemeblock
;; render : @tech{SD} -> @scheme{Scene} ;; render : @tech{SD} -> @scheme[Scene]
;; translate the current state of the door into a large text ;; translate the current state of the door into a large text
(define (render s) (define (render s)
(text (symbol->string s) 40 'red)) (text (symbol->string s) 40 'red))
(check-expecy (render 'closed) (text "closed" 40 'red)) (check-expecy (render 'closed) (text "closed" 40 'red))
)) ))
The function @scheme{symbol->string} translates a symbol into a string, The function @scheme[symbol->string] translates a symbol into a string,
which is needed because @scheme{text} can deal only with the latter, not which is needed because @scheme[text] can deal only with the latter, not
the former. A look into the language documentation revealed that this the former. A look into the language documentation revealed that this
conversion function exists, and so we use it. conversion function exists, and so we use it.