Use @(interaction-eval ...) instead of @interaction-eval[...].
svn: r9429
This commit is contained in:
parent
852b673d85
commit
1b552354a6
|
@ -54,7 +54,7 @@ public methods @scheme[get-size], @scheme[grow], and @scheme[eat]:
|
||||||
(grow (send other-fish get-size))))
|
(grow (send other-fish get-size))))
|
||||||
]
|
]
|
||||||
|
|
||||||
@interaction-eval[
|
@(interaction-eval
|
||||||
#:eval class-eval
|
#:eval class-eval
|
||||||
(define fish%
|
(define fish%
|
||||||
(class object%
|
(class object%
|
||||||
|
@ -66,7 +66,7 @@ public methods @scheme[get-size], @scheme[grow], and @scheme[eat]:
|
||||||
(define/public (grow amt)
|
(define/public (grow amt)
|
||||||
(set! current-size (+ amt current-size)))
|
(set! current-size (+ amt current-size)))
|
||||||
(define/public (eat other-fish)
|
(define/public (eat other-fish)
|
||||||
(grow (send other-fish get-size)))))]
|
(grow (send other-fish get-size))))))
|
||||||
|
|
||||||
The @scheme[size] initialization argument must be supplied via a named
|
The @scheme[size] initialization argument must be supplied via a named
|
||||||
argument when instantiating the class through the @scheme[new] form:
|
argument when instantiating the class through the @scheme[new] form:
|
||||||
|
@ -82,9 +82,9 @@ Of course, we can also name the class and its instance:
|
||||||
(define charlie (new fish% [size 10]))
|
(define charlie (new fish% [size 10]))
|
||||||
]
|
]
|
||||||
|
|
||||||
@interaction-eval[
|
@(interaction-eval
|
||||||
#:eval class-eval
|
#:eval class-eval
|
||||||
(define charlie (new fish% [size 10]))]
|
(define charlie (new fish% [size 10])))
|
||||||
|
|
||||||
In the definition of @scheme[fish%], @scheme[current-size] is a
|
In the definition of @scheme[fish%], @scheme[current-size] is a
|
||||||
private field that starts out with the value of the @scheme[size]
|
private field that starts out with the value of the @scheme[size]
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
(list (list (make-flow (list a))
|
(list (list (make-flow (list a))
|
||||||
(make-flow (list (make-paragraph (list (hspace 1)))))
|
(make-flow (list (make-paragraph (list (hspace 1)))))
|
||||||
(make-flow (list b))))))
|
(make-flow (list b))))))
|
||||||
@interaction-eval[#:eval io-eval (print-hash-table #t)]
|
@(interaction-eval #:eval io-eval (print-hash-table #t))
|
||||||
|
|
||||||
@title[#:tag "i/o" #:style 'toc]{Input and Output}
|
@title[#:tag "i/o" #:style 'toc]{Input and Output}
|
||||||
|
|
||||||
|
@ -39,9 +39,9 @@ examples:
|
||||||
file for writing, and @scheme[open-input-file] opens a file for
|
file for writing, and @scheme[open-input-file] opens a file for
|
||||||
reading.
|
reading.
|
||||||
|
|
||||||
@interaction-eval[#:eval io-eval (define old-dir (current-directory))]
|
@(interaction-eval #:eval io-eval (define old-dir (current-directory)))
|
||||||
@interaction-eval[#:eval io-eval (current-directory (find-system-path 'temp-dir))]
|
@(interaction-eval #:eval io-eval (current-directory (find-system-path 'temp-dir)))
|
||||||
@interaction-eval[#:eval io-eval (when (file-exists? "data") (delete-file "data"))]
|
@(interaction-eval #:eval io-eval (when (file-exists? "data") (delete-file "data")))
|
||||||
|
|
||||||
@examples[
|
@examples[
|
||||||
#:eval io-eval
|
#:eval io-eval
|
||||||
|
@ -81,8 +81,8 @@ with the output port; when the function returns, the port is closed.
|
||||||
(read-line in)))
|
(read-line in)))
|
||||||
]
|
]
|
||||||
|
|
||||||
@interaction-eval[#:eval io-eval (when (file-exists? "data") (delete-file "data"))]
|
@(interaction-eval #:eval io-eval (when (file-exists? "data") (delete-file "data")))
|
||||||
@interaction-eval[#:eval io-eval (current-directory old-dir)]}
|
@(interaction-eval #:eval io-eval (current-directory old-dir))}
|
||||||
|
|
||||||
@;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
@;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
@item{@bold{Strings:} The @scheme[open-output-string] function creates
|
@item{@bold{Strings:} The @scheme[open-output-string] function creates
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
@(define step @elem{=})
|
@(define step @elem{=})
|
||||||
|
|
||||||
@(define list-eval (make-base-eval))
|
@(define list-eval (make-base-eval))
|
||||||
@interaction-eval[#:eval list-eval (require scheme/list)]
|
@(interaction-eval #:eval list-eval (require scheme/list))
|
||||||
|
|
||||||
@title{Lists, Iteration, and Recursion}
|
@title{Lists, Iteration, and Recursion}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
scribble/eval
|
scribble/eval
|
||||||
"guide-utils.ss")
|
"guide-utils.ss")
|
||||||
|
|
||||||
@interaction-eval[(require (lib "mzlib/for.ss"))]
|
@(interaction-eval (require (lib "mzlib/for.ss")))
|
||||||
|
|
||||||
@title[#:tag "set!"]{Assignment: @scheme[set!]}
|
@title[#:tag "set!"]{Assignment: @scheme[set!]}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
(for-label scheme/list))
|
(for-label scheme/list))
|
||||||
|
|
||||||
@(define list-eval (make-base-eval))
|
@(define list-eval (make-base-eval))
|
||||||
@interaction-eval[#:eval list-eval (require scheme/list)]
|
@(interaction-eval #:eval list-eval (require scheme/list))
|
||||||
|
|
||||||
@title{Pairs, Lists, and Scheme Syntax}
|
@title{Pairs, Lists, and Scheme Syntax}
|
||||||
|
|
||||||
|
|
|
@ -13,20 +13,20 @@
|
||||||
@(define guide @other-manual['(lib "guide.scrbl" "scribblings/guide")])
|
@(define guide @other-manual['(lib "guide.scrbl" "scribblings/guide")])
|
||||||
|
|
||||||
@(define more-eval (make-base-eval))
|
@(define more-eval (make-base-eval))
|
||||||
@interaction-eval[#:eval more-eval
|
@(interaction-eval #:eval more-eval
|
||||||
(define (show-load re?)
|
(define (show-load re?)
|
||||||
(fprintf (current-error-port) " [~aloading serve.ss]\n" (if re? "re-" "")))]
|
(fprintf (current-error-port) " [~aloading serve.ss]\n" (if re? "re-" ""))))
|
||||||
@interaction-eval[#:eval more-eval
|
@(interaction-eval #:eval more-eval
|
||||||
(define (serve n) void)]
|
(define (serve n) void))
|
||||||
@interaction-eval[#:eval more-eval
|
@(interaction-eval #:eval more-eval
|
||||||
(define (show-break)
|
(define (show-break)
|
||||||
(fprintf (current-error-port) "^Cuser break"))]
|
(fprintf (current-error-port) "^Cuser break")))
|
||||||
@interaction-eval[#:eval more-eval
|
@(interaction-eval #:eval more-eval
|
||||||
(define (show-fail n)
|
(define (show-fail n)
|
||||||
(error 'tcp-listen
|
(error 'tcp-listen
|
||||||
"listen on ~a failed (address already in use)"
|
"listen on ~a failed (address already in use)"
|
||||||
n))]
|
n)))
|
||||||
@interaction-eval[#:eval more-eval (require xml net/url)]
|
@(interaction-eval #:eval more-eval (require xml net/url))
|
||||||
|
|
||||||
@(define (whole-prog which [last? #f])
|
@(define (whole-prog which [last? #f])
|
||||||
(let ([file (format "step~a.txt" which)])
|
(let ([file (format "step~a.txt" which)])
|
||||||
|
|
|
@ -524,7 +524,7 @@ classes. By convention, the classes are given names that end with
|
||||||
(send f show #t)
|
(send f show #t)
|
||||||
]
|
]
|
||||||
|
|
||||||
@mr-interaction-eval[(send f show #f)]
|
@(mr-interaction-eval (send f show #f))
|
||||||
|
|
||||||
The @scheme[new] form creates an instance of a class, where
|
The @scheme[new] form creates an instance of a class, where
|
||||||
initialization arguments like @scheme[label] and @scheme[width] are
|
initialization arguments like @scheme[label] and @scheme[width] are
|
||||||
|
@ -552,12 +552,12 @@ picture into a canvas:
|
||||||
]
|
]
|
||||||
|
|
||||||
@centerline{
|
@centerline{
|
||||||
@mr-interaction-eval-show[(scale
|
@(mr-interaction-eval-show (scale
|
||||||
(bitmap
|
(bitmap
|
||||||
(build-path
|
(build-path
|
||||||
(collection-path "scribblings/quick")
|
(collection-path "scribblings/quick")
|
||||||
"art.png"))
|
"art.png"))
|
||||||
0.5)]}
|
0.5))}
|
||||||
|
|
||||||
Each canvas stretches to fill an equal portion of the frame, because
|
Each canvas stretches to fill an equal portion of the frame, because
|
||||||
that's how a frame manages its children by default.
|
that's how a frame manages its children by default.
|
||||||
|
|
|
@ -70,7 +70,7 @@
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@interaction-eval[#:eval class-eval (require scheme/class)]
|
@(interaction-eval #:eval class-eval (require scheme/class))
|
||||||
|
|
||||||
|
|
||||||
@title[#:tag "mzlib:class" #:style 'toc]{Classes and Objects}
|
@title[#:tag "mzlib:class" #:style 'toc]{Classes and Objects}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
(for-label scheme/serialize))
|
(for-label scheme/serialize))
|
||||||
|
|
||||||
@(define posn-eval (make-base-eval))
|
@(define posn-eval (make-base-eval))
|
||||||
@interaction-eval[#:eval posn-eval (require (for-syntax scheme/base))]
|
@(interaction-eval #:eval posn-eval (require (for-syntax scheme/base)))
|
||||||
|
|
||||||
@title[#:tag "define-struct"]{Defining Structure Types: @scheme[define-struct]}
|
@title[#:tag "define-struct"]{Defining Structure Types: @scheme[define-struct]}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
scribble/eval)
|
scribble/eval)
|
||||||
|
|
||||||
@(define dict-eval (make-base-eval))
|
@(define dict-eval (make-base-eval))
|
||||||
@interaction-eval[#:eval dict-eval (require scheme/dict)]
|
@(interaction-eval #:eval dict-eval (require scheme/dict))
|
||||||
|
|
||||||
@title[#:tag "dicts"]{Dictionaries}
|
@title[#:tag "dicts"]{Dictionaries}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
scheme/match)
|
scheme/match)
|
||||||
|
|
||||||
@(define match-eval (make-base-eval))
|
@(define match-eval (make-base-eval))
|
||||||
@interaction-eval[#:eval match-eval (require scheme/match)]
|
@(interaction-eval #:eval match-eval (require scheme/match))
|
||||||
|
|
||||||
@title[#:tag "match"]{Pattern Matching}
|
@title[#:tag "match"]{Pattern Matching}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
scheme/math)
|
scheme/math)
|
||||||
|
|
||||||
@(define math-eval (make-base-eval))
|
@(define math-eval (make-base-eval))
|
||||||
@interaction-eval[#:eval math-eval (require scheme/math)]
|
@(interaction-eval #:eval math-eval (require scheme/math))
|
||||||
|
|
||||||
@title[#:tag "numbers"]{Numbers}
|
@title[#:tag "numbers"]{Numbers}
|
||||||
|
|
||||||
|
|
|
@ -404,7 +404,7 @@ applied.}
|
||||||
|
|
||||||
@note-lib[scheme/function]
|
@note-lib[scheme/function]
|
||||||
@(define fun-eval (make-base-eval))
|
@(define fun-eval (make-base-eval))
|
||||||
@interaction-eval[#:eval fun-eval (require scheme/function)]
|
@(interaction-eval #:eval fun-eval (require scheme/function))
|
||||||
|
|
||||||
@defproc[(negate [proc procedure?]) procedure?]{
|
@defproc[(negate [proc procedure?]) procedure?]{
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
scheme/gui/dynamic))
|
scheme/gui/dynamic))
|
||||||
|
|
||||||
@(define box-eval (make-base-eval))
|
@(define box-eval (make-base-eval))
|
||||||
@interaction-eval[#:eval box-eval (require scheme/sandbox)]
|
@(interaction-eval #:eval box-eval (require scheme/sandbox))
|
||||||
|
|
||||||
@title{Sandboxed Evaluation}
|
@title{Sandboxed Evaluation}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
(for-label scheme/serialize))
|
(for-label scheme/serialize))
|
||||||
|
|
||||||
@(define ser-eval (make-base-eval))
|
@(define ser-eval (make-base-eval))
|
||||||
@interaction-eval[#:eval ser-eval (require scheme/serialize)]
|
@(interaction-eval #:eval ser-eval (require scheme/serialize))
|
||||||
|
|
||||||
@title[#:tag "serialization"]{Serialization}
|
@title[#:tag "serialization"]{Serialization}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
|
|
||||||
@(define shared-eval (make-base-eval))
|
@(define shared-eval (make-base-eval))
|
||||||
@interaction-eval[#:eval shared-eval (require scheme/shared)]
|
@(interaction-eval #:eval shared-eval (require scheme/shared))
|
||||||
|
|
||||||
@(define maker
|
@(define maker
|
||||||
(make-element #f (list
|
(make-element #f (list
|
||||||
|
|
|
@ -367,7 +367,7 @@ allocated string).}
|
||||||
|
|
||||||
@note-lib[scheme/string]
|
@note-lib[scheme/string]
|
||||||
@(define string-eval (make-base-eval))
|
@(define string-eval (make-base-eval))
|
||||||
@interaction-eval[#:eval string-eval (require scheme/string scheme/list)]
|
@(interaction-eval #:eval string-eval (require scheme/string scheme/list))
|
||||||
|
|
||||||
@defproc[(string-append* [str string?] ... [strs (listof string?)]) string?]{
|
@defproc[(string-append* [str string?] ... [strs (listof string?)]) string?]{
|
||||||
@; Note: this is exactly the same description as the one for append*
|
@; Note: this is exactly the same description as the one for append*
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
scheme/provide-syntax))
|
scheme/provide-syntax))
|
||||||
|
|
||||||
@(define stx-eval (make-base-eval))
|
@(define stx-eval (make-base-eval))
|
||||||
@interaction-eval[#:eval stx-eval (require (for-syntax scheme/base))]
|
@(interaction-eval #:eval stx-eval (require (for-syntax scheme/base)))
|
||||||
|
|
||||||
@(define (transform-time) @t{This procedure must be called during the
|
@(define (transform-time) @t{This procedure must be called during the
|
||||||
dynamic extent of a @tech{syntax transformer} application by the
|
dynamic extent of a @tech{syntax transformer} application by the
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
use-at-readtable)))
|
use-at-readtable)))
|
||||||
|
|
||||||
@(define read-eval (make-base-eval))
|
@(define read-eval (make-base-eval))
|
||||||
@interaction-eval[#:eval read-eval (require (for-syntax scheme/base))]
|
@(interaction-eval #:eval read-eval (require (for-syntax scheme/base)))
|
||||||
|
|
||||||
@title[#:tag "reader"]{@"@"-Reader}
|
@title[#:tag "reader"]{@"@"-Reader}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user