The Scribble reader was improved to make it pull out the syntax
punctuations outside of the form, as it does with quote punctuations. So things like this #, @foo{...} that required the space to make the @foo read as a scribble form are now better written as @#,foo{...} This changes all such occurrences. (In case you see this change in your files and are worried that there might be changes: I mechanically verified that the result of `read'ing the modified files is identical to the previous version.) svn: r15111
This commit is contained in:
parent
575a348e8a
commit
4288c6c2c7
|
@ -25,11 +25,11 @@ Abstraktion - fortgeschritten} that goes with the German textbook
|
|||
string
|
||||
character
|
||||
(quoted ...)
|
||||
#, @elem{@schemevalfont{'}@scheme[quoted]}]
|
||||
@#,elem{@schemevalfont{'}@scheme[quoted]}]
|
||||
)
|
||||
(
|
||||
(set! id expr)
|
||||
(code:line #, @elem{@schemevalfont{'}@scheme[quoted]} (code:comment #, @seclink["advanced-quote"]{Quote-Literal}))
|
||||
(code:line @#,elem{@schemevalfont{'}@scheme[quoted]} (code:comment @#,seclink["advanced-quote"]{Quote-Literal}))
|
||||
)
|
||||
]
|
||||
|
||||
|
|
|
@ -67,10 +67,10 @@ Schreiben Sie dann eine Datendefinition, die mit folgenden Worten
|
|||
anfängt:
|
||||
|
||||
@schemeblock[
|
||||
(code:comment #, @t{Ein @scheme[x] besteht aus / hat:})
|
||||
(code:comment #, @t{- @scheme[#,(elem (scheme Feld) (subscript "1"))] @scheme[(#,(elem (scheme ctr) (subscript "1")))]})
|
||||
(code:comment #, @t{...})
|
||||
(code:comment #, @t{- @scheme[#,(elem (scheme Feld) (subscript "n"))] @scheme[(#,(elem (scheme ctr) (subscript "n")))]})
|
||||
(code:comment @#,t{Ein @scheme[x] besteht aus / hat:})
|
||||
(code:comment @#,t{- @scheme[#,(elem (scheme Feld) (subscript "1"))] @scheme[(#,(elem (scheme ctr) (subscript "1")))]})
|
||||
(code:comment @#,t{...})
|
||||
(code:comment @#,t{- @scheme[#,(elem (scheme Feld) (subscript "n"))] @scheme[(#,(elem (scheme ctr) (subscript "n")))]})
|
||||
]
|
||||
|
||||
Dabei ist @scheme[x] ein umgangssprachlicher Name für die Sorte
|
||||
|
@ -125,11 +125,11 @@ Wenn bei der Datenanalyse gemischte Daten auftauchen, schreiben Sie
|
|||
eine Datendefinition der Form:
|
||||
|
||||
@schemeblock[
|
||||
(code:comment #, @t{Ein @scheme[x] ist eins der Folgenden:})
|
||||
(code:comment #, @t{- @elem[(scheme Sorte) (subscript "1")] (@elem[(scheme ctr) (subscript "1")])})
|
||||
(code:comment #, @t{...})
|
||||
(code:comment #, @t{- @elem[(scheme Sorte) (subscript "n")] (@elem[(scheme ctr) (subscript "n")])})
|
||||
(code:comment #, @t{Name: @scheme[ctr]})
|
||||
(code:comment @#,t{Ein @scheme[x] ist eins der Folgenden:})
|
||||
(code:comment @#,t{- @elem[(scheme Sorte) (subscript "1")] (@elem[(scheme ctr) (subscript "1")])})
|
||||
(code:comment @#,t{...})
|
||||
(code:comment @#,t{- @elem[(scheme Sorte) (subscript "n")] (@elem[(scheme ctr) (subscript "n")])})
|
||||
(code:comment @#,t{Name: @scheme[ctr]})
|
||||
]
|
||||
|
||||
Dabei sind die @elem[(scheme Sorte) (subscript "i")] umgangssprachliche Namen
|
||||
|
|
|
@ -37,18 +37,18 @@ Dieses teachpack definiert Prozeduren für lineare Algebra und 3D-Rendering:
|
|||
Zum Beispiel:
|
||||
|
||||
@schemeblock[
|
||||
(code:comment #, @t{scene-data (simple box example)})
|
||||
(code:comment @#,t{scene-data (simple box example)})
|
||||
(define box
|
||||
(create-box 1.0 1.0 1.0 "brown"))
|
||||
(code:comment #, @t{screen})
|
||||
(code:comment @#,t{screen})
|
||||
(define screenWidth 320)
|
||||
(define screenHeight 240)
|
||||
(code:comment #, @t{camera})
|
||||
(code:comment @#,t{camera})
|
||||
(define pos (make-vec3 5 5 3))
|
||||
(define lookat (make-vec3 0 0 0))
|
||||
(define camera
|
||||
(create-camera-matrix pos lookat 70.0 screenWidth screenHeight))
|
||||
(code:comment #, @t{render image})
|
||||
(code:comment @#,t{render image})
|
||||
(render-scene screenWidth screenHeight box camera)
|
||||
]
|
||||
|
||||
|
@ -237,4 +237,4 @@ und @scheme[b] zurück (einen Vektor der senkrecht auf @scheme[a] und @scheme[b]
|
|||
@defthing[transform-primitive-list ((list line3d) matrix4x4 -> (list line3d))]{
|
||||
@scheme[(transform-primitive-list scene transformationr)] wendet @scheme[transformation] auf alle Punkte der Linien in @scheme[scene] an und gibt
|
||||
diese zurück.
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,49 +26,49 @@
|
|||
expr
|
||||
test-case
|
||||
#;library-require]
|
||||
[definition #, @scheme[(define id expr)]
|
||||
#, @scheme[(define-record-procedures id id id (id (... ...)))]
|
||||
#, @scheme[(define-record-procedures-parametric (id id (... ...)) id id (id (... ...)))]
|
||||
#, @scheme[(define-contract id contract)]
|
||||
#, @scheme[(: id contract)]
|
||||
[definition @#,scheme[(define id expr)]
|
||||
@#,scheme[(define-record-procedures id id id (id (... ...)))]
|
||||
@#,scheme[(define-record-procedures-parametric (id id (... ...)) id id (id (... ...)))]
|
||||
@#,scheme[(define-contract id contract)]
|
||||
@#,scheme[(: id contract)]
|
||||
def-rule ...]
|
||||
prod ...
|
||||
[expr #, @scheme[(code:line (expr expr (... ...)) (code:comment #, @seclink["application"]{Prozedurapplikation}))]
|
||||
#, @scheme[#t]
|
||||
#, @scheme[#f]
|
||||
#, @scheme[number]
|
||||
#, @scheme[string]
|
||||
#, @scheme[(lambda (id (... ...)) expr)]
|
||||
#, @scheme[(code:line id (code:comment #, @seclink["id"]{Bezeichner}))]
|
||||
#, @scheme[(cond (expr expr) (expr expr) (... ...))]
|
||||
#, @scheme[(cond (expr expr) (... ...) (else expr))]
|
||||
#, @scheme[(if expr expr)]
|
||||
#, @scheme[(and expr (... ...))]
|
||||
#, @scheme[(or expr (... ...))]
|
||||
#, @scheme[(let ((id expr) (... ...)) expr)]
|
||||
#, @scheme[(letrec ((id expr) (... ...)) expr)]
|
||||
#, @scheme[(let* ((id expr) (... ...)) expr) ]
|
||||
#, @scheme[(begin expr expr (... ...))]
|
||||
[expr @#,scheme[(code:line (expr expr (... ...)) (code:comment @#,seclink["application"]{Prozedurapplikation}))]
|
||||
@#,scheme[#t]
|
||||
@#,scheme[#f]
|
||||
@#,scheme[number]
|
||||
@#,scheme[string]
|
||||
@#,scheme[(lambda (id (... ...)) expr)]
|
||||
@#,scheme[(code:line id (code:comment @#,seclink["id"]{Bezeichner}))]
|
||||
@#,scheme[(cond (expr expr) (expr expr) (... ...))]
|
||||
@#,scheme[(cond (expr expr) (... ...) (else expr))]
|
||||
@#,scheme[(if expr expr)]
|
||||
@#,scheme[(and expr (... ...))]
|
||||
@#,scheme[(or expr (... ...))]
|
||||
@#,scheme[(let ((id expr) (... ...)) expr)]
|
||||
@#,scheme[(letrec ((id expr) (... ...)) expr)]
|
||||
@#,scheme[(let* ((id expr) (... ...)) expr) ]
|
||||
@#,scheme[(begin expr expr (... ...))]
|
||||
expr-rule ...]
|
||||
[contract id
|
||||
#, @scheme[(predicate expr)]
|
||||
#, @scheme[(one-of expr (... ...))]
|
||||
#, @scheme[(mixed contract (... ...))]
|
||||
#, @scheme[(code:line (contract (... ...) -> contract) (code:comment #, @seclink["proc-contract"]{Prozedur-Vertrag}))]
|
||||
#, @scheme[(list contract)]
|
||||
#, @scheme[(code:line %a %b %c (code:comment #, @seclink["contract-variable"]{Vertrags-Variable}))]
|
||||
#, @scheme[(combined contract (... ...))]
|
||||
#, @scheme[(property expr contract)]
|
||||
@#,scheme[(predicate expr)]
|
||||
@#,scheme[(one-of expr (... ...))]
|
||||
@#,scheme[(mixed contract (... ...))]
|
||||
@#,scheme[(code:line (contract (... ...) -> contract) (code:comment @#,seclink["proc-contract"]{Prozedur-Vertrag}))]
|
||||
@#,scheme[(list contract)]
|
||||
@#,scheme[(code:line %a %b %c (code:comment @#,seclink["contract-variable"]{Vertrags-Variable}))]
|
||||
@#,scheme[(combined contract (... ...))]
|
||||
@#,scheme[(property expr contract)]
|
||||
]
|
||||
[test-case #, @scheme[(check-expect expr expr)]
|
||||
#, @scheme[(check-within expr expr expr)]
|
||||
#, @scheme[(check-error expr expr)]]
|
||||
[test-case @#,scheme[(check-expect expr expr)]
|
||||
@#,scheme[(check-within expr expr expr)]
|
||||
@#,scheme[(check-error expr expr)]]
|
||||
#;(...
|
||||
[library-require #, @scheme[(require string)]
|
||||
#, @scheme[(require (lib string string ...))]
|
||||
#, @scheme[(require (planet string package))]])
|
||||
[library-require @#,scheme[(require string)]
|
||||
@#,scheme[(require (lib string string ...))]
|
||||
@#,scheme[(require (planet string package))]])
|
||||
(...
|
||||
[package #, @scheme[(string string number number)]])))
|
||||
[package @#,scheme[(string string number number)]])))
|
||||
|
||||
(define prim-nonterms
|
||||
(make-splice
|
||||
|
|
|
@ -159,10 +159,10 @@ space for each @scheme[field-id] within the instance is deallocated.
|
|||
#:eval objc-eval
|
||||
(eval:alts
|
||||
(define-objc-class MyView NSView
|
||||
[bm] (code:comment #, @elem{<- one field})
|
||||
[bm] (code:comment @#,elem{<- one field})
|
||||
(- _scheme (swapBitwmap: [_scheme new-bm])
|
||||
(begin0 bm (set! bm new-bm)))
|
||||
(- _void (drawRect: [#, @schemeidfont{_NSRect} exposed-rect])
|
||||
(- _void (drawRect: [@#,schemeidfont{_NSRect} exposed-rect])
|
||||
(super-tell drawRect: exposed-rect)
|
||||
(draw-bitmap-region bm exposed-rect))
|
||||
(- _void (dealloc)
|
||||
|
|
|
@ -616,20 +616,20 @@ result of @scheme[(viewport-dc viewport)], too.}
|
|||
|
||||
@schemeblock[
|
||||
(open-graphics)
|
||||
(code:comment #, @t{nothing appears to happen, but the library is initialized...})
|
||||
(code:comment @#,t{nothing appears to happen, but the library is initialized...})
|
||||
|
||||
(define w (open-viewport "practice" 300 300))
|
||||
(code:comment #, @t{viewport window appears})
|
||||
(code:comment @#,t{viewport window appears})
|
||||
|
||||
((draw-line w) (make-posn 30 30) (make-posn 100 100))
|
||||
(code:comment #, @t{line appears})
|
||||
(code:comment @#,t{line appears})
|
||||
|
||||
(close-viewport w)
|
||||
(code:comment #, @t{viewport disappears})
|
||||
(code:comment @#,t{viewport disappears})
|
||||
|
||||
(close-graphics)
|
||||
(code:comment #, @t{again, nothing appears to happen, but})
|
||||
(code:comment #, @t{unclosed viewports (if any) would disappear})
|
||||
(code:comment @#,t{again, nothing appears to happen, but})
|
||||
(code:comment @#,t{unclosed viewports (if any) would disappear})
|
||||
]
|
||||
|
||||
@section{A More Complicated Example}
|
||||
|
@ -640,21 +640,21 @@ viewport:
|
|||
|
||||
@schemeblock[
|
||||
(open-graphics)
|
||||
(let* ((code:comment #, @t{@scheme[w1] and @scheme[w2] are viewports for different windows})
|
||||
(let* ((code:comment @#,t{@scheme[w1] and @scheme[w2] are viewports for different windows})
|
||||
[w1 (open-viewport "viewport 1" 300 300)]
|
||||
[w2 (open-viewport "viewport 2" 200 500)]
|
||||
(code:comment #, @t{@scheme[d1] and @scheme[d2] draw lines in different viewports})
|
||||
(code:comment @#,t{@scheme[d1] and @scheme[d2] draw lines in different viewports})
|
||||
[d1 (draw-line w1)]
|
||||
[d2 (draw-line w2)])
|
||||
(code:comment #, @t{draws a line in viewport labeled ``viewport 1''})
|
||||
(code:comment @#,t{draws a line in viewport labeled ``viewport 1''})
|
||||
(d1 (make-posn 100 5) (make-posn 5 100))
|
||||
(code:comment #, @t{draws a line in viewport labeled ``viewport 2''})
|
||||
(code:comment @#,t{draws a line in viewport labeled ``viewport 2''})
|
||||
(d2 (make-posn 100 100) (make-posn 101 400)))
|
||||
|
||||
(code:comment #, @t{we no longer have access to viewports 1 and 2,})
|
||||
(code:comment #, @t{since their descriptors did not escape the @scheme[let]})
|
||||
(code:comment @#,t{we no longer have access to viewports 1 and 2,})
|
||||
(code:comment @#,t{since their descriptors did not escape the @scheme[let]})
|
||||
(close-graphics)
|
||||
(code:comment #, @t{removes the viewports})
|
||||
(code:comment @#,t{removes the viewports})
|
||||
]
|
||||
|
||||
@section{Protecting Graphics Operations}
|
||||
|
@ -666,12 +666,12 @@ programmer should use @scheme[dynamic-wind:]
|
|||
@schemeblock[
|
||||
(let ([w (open-viewport "hello" 100 100)])
|
||||
(dynamic-wind
|
||||
(code:comment #, @t{what we want to happen first: nothing})
|
||||
(code:comment @#,t{what we want to happen first: nothing})
|
||||
void
|
||||
(code:comment #, @t{the main program (errors constrained to this piece)})
|
||||
(lambda () (draw-pixel 13)) (code:comment #, @t{an error})
|
||||
(code:comment #, @t{what we would like to happen, whether the main program})
|
||||
(code:comment #, @t{finishes normally or not})
|
||||
(code:comment @#,t{the main program (errors constrained to this piece)})
|
||||
(lambda () (draw-pixel 13)) (code:comment @#,t{an error})
|
||||
(code:comment @#,t{what we would like to happen, whether the main program})
|
||||
(code:comment @#,t{finishes normally or not})
|
||||
(lambda () (close-viewport w))))
|
||||
]
|
||||
|
||||
|
|
|
@ -50,9 +50,9 @@ Reads HTML from a port, producing an @xexpr compatible with the
|
|||
@def+int[
|
||||
(module html-example scheme
|
||||
|
||||
(code:comment #, @t{Some of the symbols in @schememodname[html] and @schememodname[xml] conflict with})
|
||||
(code:comment #, @t{each other and with scheme/base language, so we prefix})
|
||||
(code:comment #, @t{to avoid namespace conflict.})
|
||||
(code:comment @#,t{Some of the symbols in @schememodname[html] and @schememodname[xml] conflict with})
|
||||
(code:comment @#,t{each other and with scheme/base language, so we prefix})
|
||||
(code:comment @#,t{to avoid namespace conflict.})
|
||||
(require (prefix-in h: html)
|
||||
(prefix-in x: xml))
|
||||
|
||||
|
@ -64,8 +64,8 @@ Reads HTML from a port, producing an @xexpr compatible with the
|
|||
"<p>Hello world</p><p><b>Testing</b>!</p>"
|
||||
"</body></html>"))))
|
||||
|
||||
(code:comment #, @t{extract-pcdata: html-content -> (listof string)})
|
||||
(code:comment #, @t{Pulls out the pcdata strings from some-content.})
|
||||
(code:comment @#,t{extract-pcdata: html-content -> (listof string)})
|
||||
(code:comment @#,t{Pulls out the pcdata strings from some-content.})
|
||||
(define (extract-pcdata some-content)
|
||||
(cond [(x:pcdata? some-content)
|
||||
(list (x:pcdata-string some-content))]
|
||||
|
@ -74,8 +74,8 @@ Reads HTML from a port, producing an @xexpr compatible with the
|
|||
[else
|
||||
(extract-pcdata-from-element some-content)]))
|
||||
|
||||
(code:comment #, @t{extract-pcdata-from-element: html-element -> (listof string)})
|
||||
(code:comment #, @t{Pulls out the pcdata strings from an-html-element.})
|
||||
(code:comment @#,t{extract-pcdata-from-element: html-element -> (listof string)})
|
||||
(code:comment @#,t{Pulls out the pcdata strings from an-html-element.})
|
||||
(define (extract-pcdata-from-element an-html-element)
|
||||
(match an-html-element
|
||||
[(struct h:html-full (attributes content))
|
||||
|
|
|
@ -45,7 +45,7 @@ can be used to write lazy code. To write lazy code, simply use
|
|||
|
||||
@schememod[
|
||||
lazy
|
||||
... #, @elem{lazy code here}...]
|
||||
... @#,elem{lazy code here}...]
|
||||
|
||||
Function applications are delayed, and promises are automatically
|
||||
forced. The language provides bindings that are equivalent to most of
|
||||
|
|
|
@ -34,11 +34,11 @@ little setup program (as an executable) in your distribution:
|
|||
(require mzlib/runtime-path
|
||||
mzlib/process)
|
||||
|
||||
(code:comment #, @t{Ensure that DLLs are included with the distribution:})
|
||||
(code:comment @#,t{Ensure that DLLs are included with the distribution:})
|
||||
(define-runtime-path myspage-dll '(so "myspage"))
|
||||
(define-runtime-path myssink-dll '(so "myssink"))
|
||||
|
||||
(code:comment #, @t{Register the DLLs:})
|
||||
(code:comment @#,t{Register the DLLs:})
|
||||
(define regsvr32
|
||||
(path->string (find-executable-path "regsvr32.exe" #f)))
|
||||
(system* regsvr32 (path->string myspage-dll))
|
||||
|
|
|
@ -117,7 +117,7 @@ The same binding as @scheme[#%app]. (This binding was not present in
|
|||
([head id
|
||||
(head args)]
|
||||
[args (code:line arg-id ...)
|
||||
(code:line arg-id ... #, @schemeparenfont{.} rest-id)])]{
|
||||
(code:line arg-id ... @#,schemeparenfont{.} rest-id)])]{
|
||||
|
||||
Like @|base-define| in @schememodname[scheme/base], but without
|
||||
support for keyword arguments or optional arguments.}
|
||||
|
|
|
@ -112,7 +112,7 @@ Raised for errors when handling cookies.}
|
|||
Produces
|
||||
|
||||
@schemeblock[
|
||||
#, @schemeresultfont{"foo=bar; Max-Age=3600; Path=/servlets; Version=1"}
|
||||
@#,schemeresultfont{"foo=bar; Max-Age=3600; Path=/servlets; Version=1"}
|
||||
]
|
||||
|
||||
To use this output in a ``regular'' CGI, instead of the last line use:
|
||||
|
|
|
@ -381,10 +381,10 @@ message-state changes (so they will not show up through
|
|||
@examples[
|
||||
(eval:alts (imap-store imap '+ '(1 2 3) (list (symbol->imap-flag 'deleted)))
|
||||
(void))
|
||||
(code:comment #, @t{marks the first three messages to be deleted})
|
||||
(code:comment @#,t{marks the first three messages to be deleted})
|
||||
(eval:alts (imap-expunge imap) (void))
|
||||
(code:comment #, @t{permanently removes the first three messages (and possibly})
|
||||
(code:comment #, @t{others) from the currently-selected mailbox})
|
||||
(code:comment @#,t{permanently removes the first three messages (and possibly})
|
||||
(code:comment @#,t{others) from the currently-selected mailbox})
|
||||
]}
|
||||
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ Raised when the server produces a mal-formed response.}
|
|||
"Status: RO")
|
||||
("some body" "text" "goes" "." "here" "." "")
|
||||
#,pt (get-unique-id/single c 205)
|
||||
#, @schemeerror{no message numbered 205 available for unique id}
|
||||
@#,schemeerror{no message numbered 205 available for unique id}
|
||||
#,pt (list-tail (get-unique-id/all c) 194)
|
||||
((195 . "e24d13c7ef050000") (196 . "3ad2767070050000"))
|
||||
#,pt (get-unique-id/single c 196)
|
||||
|
|
|
@ -31,7 +31,7 @@ See also @scheme[tcp-redirect] and @scheme[make-ssl-tcp@].
|
|||
[max-allow-wait exact-nonnegative-integer? 4]
|
||||
[reuse? any/c #f]
|
||||
[hostname (or/c string? false/c) #f])
|
||||
#, @sigelem[tcp^ tcp-listener?]]{
|
||||
@#,sigelem[tcp^ tcp-listener?]]{
|
||||
|
||||
Like @scheme[tcp-listen] from @schememodname[scheme/tcp].}
|
||||
|
||||
|
@ -58,21 +58,21 @@ Like @scheme[tcp-connect] from @schememodname[scheme/tcp].}
|
|||
|
||||
Like @scheme[tcp-connect/enable-break] from @schememodname[scheme/tcp].}
|
||||
|
||||
@defproc[(tcp-accept [listener #, @sigelem[tcp^ tcp-listener?]])
|
||||
@defproc[(tcp-accept [listener @#,sigelem[tcp^ tcp-listener?]])
|
||||
(values input-port? output-port?)]{
|
||||
|
||||
Like @scheme[tcp-accept] from @schememodname[scheme/tcp].}
|
||||
|
||||
@defproc[(tcp-accept/enable-break [listener #, @sigelem[tcp^ tcp-listener?]])
|
||||
@defproc[(tcp-accept/enable-break [listener @#,sigelem[tcp^ tcp-listener?]])
|
||||
(values input-port? output-port?)]{
|
||||
|
||||
Like @scheme[tcp-accept/enable-break] from @schememodname[scheme/tcp].}
|
||||
|
||||
@defproc[(tcp-accept-ready? [listener #, @sigelem[tcp^ tcp-listener?]]) boolean?]{
|
||||
@defproc[(tcp-accept-ready? [listener @#,sigelem[tcp^ tcp-listener?]]) boolean?]{
|
||||
|
||||
Like @scheme[tcp-accept-ready?] from @schememodname[scheme/tcp].}
|
||||
|
||||
@defproc[(tcp-close [listener #, @sigelem[tcp^ tcp-listener?]]) void?]{
|
||||
@defproc[(tcp-close [listener @#,sigelem[tcp^ tcp-listener?]]) void?]{
|
||||
|
||||
Like @scheme[tcp-close] from @schememodname[scheme/tcp].}
|
||||
|
||||
|
|
|
@ -141,19 +141,19 @@ use/recognize only of the separators.
|
|||
@examples[
|
||||
#:eval uri-codec-eval
|
||||
(define ex '((x . "foo") (y . "bar") (z . "baz")))
|
||||
(code:line (current-alist-separator-mode 'amp) (code:comment #, @t{try @scheme['amp]...}))
|
||||
(code:line (current-alist-separator-mode 'amp) (code:comment @#,t{try @scheme['amp]...}))
|
||||
(form-urlencoded->alist "x=foo&y=bar&z=baz")
|
||||
(form-urlencoded->alist "x=foo;y=bar;z=baz")
|
||||
(alist->form-urlencoded ex)
|
||||
(code:line (current-alist-separator-mode 'semi) (code:comment #, @t{try @scheme['semi]...}))
|
||||
(code:line (current-alist-separator-mode 'semi) (code:comment @#,t{try @scheme['semi]...}))
|
||||
(form-urlencoded->alist "x=foo;y=bar;z=baz")
|
||||
(form-urlencoded->alist "x=foo&y=bar&z=baz")
|
||||
(alist->form-urlencoded ex)
|
||||
(code:line (current-alist-separator-mode 'amp-or-semi) (code:comment #, @t{try @scheme['amp-or-semi]...}))
|
||||
(code:line (current-alist-separator-mode 'amp-or-semi) (code:comment @#,t{try @scheme['amp-or-semi]...}))
|
||||
(form-urlencoded->alist "x=foo&y=bar&z=baz")
|
||||
(form-urlencoded->alist "x=foo;y=bar;z=baz")
|
||||
(alist->form-urlencoded ex)
|
||||
(code:line (current-alist-separator-mode 'semi-or-amp) (code:comment #, @t{try @scheme['semi-or-amp]...}))
|
||||
(code:line (current-alist-separator-mode 'semi-or-amp) (code:comment @#,t{try @scheme['semi-or-amp]...}))
|
||||
(form-urlencoded->alist "x=foo&y=bar&z=baz")
|
||||
(form-urlencoded->alist "x=foo;y=bar;z=baz")
|
||||
(alist->form-urlencoded ex)
|
||||
|
|
|
@ -458,7 +458,7 @@ the right choice when using @scheme[lexer] in other situations.
|
|||
|
||||
Like @scheme[define-tokens], except a each token constructor
|
||||
@schemeidfont{token-}@scheme[token-id] takes no arguments and returns
|
||||
@scheme[(#, @scheme[quote] token-id)].}
|
||||
@scheme[(@#,scheme[quote] token-id)].}
|
||||
|
||||
|
||||
@defproc[(token-name [t (or/c token? symbol?)]) symbol?]{
|
||||
|
@ -494,7 +494,7 @@ the right choice when using @scheme[lexer] in other situations.
|
|||
(tokens group-id ...)
|
||||
(start non-terminal-id ...)
|
||||
(end token-id ...)
|
||||
(#, @schemeidfont{error} expr)
|
||||
(@#,schemeidfont{error} expr)
|
||||
(precs (assoc token-id ...) ...)
|
||||
(src-pos)
|
||||
(suppress)
|
||||
|
@ -574,7 +574,7 @@ the right choice when using @scheme[lexer] in other situations.
|
|||
that parses entire lines individually.}
|
||||
|
||||
|
||||
@item{@scheme[(#, @schemeidfont{error} expr)]
|
||||
@item{@scheme[(@#,schemeidfont{error} expr)]
|
||||
|
||||
The @scheme[expr] should evaluate to a function which will be
|
||||
executed for its side-effect whenever the parser encounters an
|
||||
|
|
|
@ -178,7 +178,7 @@ are searched in order, and before the installation's collections.
|
|||
|
||||
The @schememodname[r6rs] language is usually used in the form
|
||||
@schememetafont{#!}@schememodname[r6rs], which is equivalent to
|
||||
@scheme[#, @hash-lang[] #, @schememodname[r6rs]] and is also valid
|
||||
@scheme[@#,hash-lang[] @#,schememodname[r6rs]] and is also valid
|
||||
@|r6rs| syntax.
|
||||
|
||||
The @schememodname[r6rs] module language provides only a
|
||||
|
@ -259,13 +259,13 @@ applied to each symbol before concatenating them:
|
|||
Examples (assuming a typical PLT Scheme installation):
|
||||
|
||||
@schemeblock[
|
||||
(rnrs io simple (6)) #, @elem{means} (lib "rnrs/io/simple-6.ss")
|
||||
(rnrs) #, @elem{means} (lib "rnrs/main-6.ss")
|
||||
(rnrs main) #, @elem{means} (lib "rnrs/main_.ss")
|
||||
(rnrs (6)) #, @elem{means} (lib "rnrs/main-6.ss")
|
||||
(scheme base) #, @elem{means} (lib "scheme/base.ss")
|
||||
(achtung!) #, @elem{means} (lib "achtung%21/main.ss")
|
||||
(funco new-λ) #, @elem{means} (lib "funco/new-%ce%bb.ss")
|
||||
(rnrs io simple (6)) @#,elem{means} (lib "rnrs/io/simple-6.ss")
|
||||
(rnrs) @#,elem{means} (lib "rnrs/main-6.ss")
|
||||
(rnrs main) @#,elem{means} (lib "rnrs/main_.ss")
|
||||
(rnrs (6)) @#,elem{means} (lib "rnrs/main-6.ss")
|
||||
(scheme base) @#,elem{means} (lib "scheme/base.ss")
|
||||
(achtung!) @#,elem{means} (lib "achtung%21/main.ss")
|
||||
(funco new-λ) @#,elem{means} (lib "funco/new-%ce%bb.ss")
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -282,7 +282,7 @@ Multiple ellipses are allowed. For example, this @|pattern|:
|
|||
|
||||
matches this sexpression:
|
||||
|
||||
@schemeblock[(#, @|tttterm| (a a))]
|
||||
@schemeblock[(@#,tttterm (a a))]
|
||||
|
||||
three different ways. One where the first @tt{a} in the @pattern
|
||||
matches nothing, and the second matches both of the
|
||||
|
@ -302,7 +302,7 @@ As an example, this @|pattern|:
|
|||
|
||||
only matches this sexpression:
|
||||
|
||||
@schemeblock[(#, @|tttterm| (a a))]
|
||||
@schemeblock[(@#,tttterm (a a))]
|
||||
|
||||
one way, with each named @pattern matching a single a. Unlike
|
||||
the above, the two @|pattern|s with mismatched lengths is ruled
|
||||
|
@ -318,7 +318,7 @@ Thus, with the @|pattern|:
|
|||
|
||||
and the expression
|
||||
|
||||
@schemeblock[(#, @|tttterm| (a a))]
|
||||
@schemeblock[(@#,tttterm (a a))]
|
||||
|
||||
two matches occur, one where @tt{x} is bound to @scheme['()] and
|
||||
@tt{y} is bound to @scheme['(a a)] and one where @tt{x} is bound to
|
||||
|
@ -328,8 +328,8 @@ bound to @scheme['()].
|
|||
}
|
||||
]
|
||||
|
||||
@defform*[[(redex-match lang #, @|ttpattern| any)
|
||||
(redex-match lang #, @|ttpattern|)]]{
|
||||
@defform*[[(redex-match lang @#,ttpattern any)
|
||||
(redex-match lang @#,ttpattern)]]{
|
||||
|
||||
If @scheme[redex-match] receives three arguments, it
|
||||
matches the pattern (in the language) against its third
|
||||
|
@ -446,7 +446,7 @@ them.}
|
|||
produces the boolean or the string.}
|
||||
]
|
||||
|
||||
@defform[(term #, @|tttterm|)]{
|
||||
@defform[(term @#,tttterm)]{
|
||||
|
||||
This form is used for construction of a term.
|
||||
|
||||
|
@ -508,7 +508,7 @@ Redex's full pattern matching facilities, see @scheme[term-match] and
|
|||
|
||||
}
|
||||
|
||||
@defform[(term-match language [#, @|ttpattern| expression] ...)]{
|
||||
@defform[(term-match language [@#,ttpattern expression] ...)]{
|
||||
|
||||
This produces a procedure that accepts term (or quoted)
|
||||
expressions and checks them against each pattern. The
|
||||
|
@ -522,7 +522,7 @@ compiled in an effort to speed up matching. Using the procedural
|
|||
result multiple times to avoid compiling the patterns multiple times.
|
||||
}
|
||||
|
||||
@defform[(term-match/single language [#, @|ttpattern| expression] ...)]{
|
||||
@defform[(term-match/single language [@#,ttpattern expression] ...)]{
|
||||
|
||||
This produces a procedure that accepts term (or quoted)
|
||||
expressions and checks them against each pattern. The
|
||||
|
@ -578,7 +578,7 @@ all non-GUI portions of Redex) and also exported by
|
|||
@schememodname[redex] (which includes all of Redex).
|
||||
|
||||
@defform/subs[(define-language lang-name
|
||||
(non-terminal-spec #, @|ttpattern| ...)
|
||||
(non-terminal-spec @#,ttpattern ...)
|
||||
...)
|
||||
([non-terminal-spec symbol (symbol ...)])]{
|
||||
|
||||
|
@ -613,7 +613,7 @@ variables, @scheme[c] for the evaluation contexts and @scheme[v] for values.
|
|||
}
|
||||
|
||||
@defform[(define-extended-language language language
|
||||
(non-terminal #, @|ttpattern| ...)
|
||||
(non-terminal @#,ttpattern ...)
|
||||
...)]{
|
||||
|
||||
This form extends a language with some new, replaced, or
|
||||
|
@ -671,13 +671,13 @@ all non-GUI portions of Redex) and also exported by
|
|||
|
||||
@defform/subs[#:literals (--> fresh side-condition where)
|
||||
(reduction-relation language domain main-arrow reduction-case ...)
|
||||
([domain (code:line) (code:line #:domain #, @|ttpattern|)]
|
||||
([domain (code:line) (code:line #:domain @#,ttpattern)]
|
||||
[main-arrow (code:line) (code:line #:arrow arrow)]
|
||||
[reduction-case (--> #, @|ttpattern| #, @|tttterm| extras ...)]
|
||||
[reduction-case (--> @#,ttpattern @#,tttterm extras ...)]
|
||||
[extras name
|
||||
(fresh fresh-clause ...)
|
||||
(side-condition scheme-expression ...)
|
||||
(where tl-pat #, @|tttterm|)]
|
||||
(where tl-pat @#,tttterm)]
|
||||
[fresh-clause var ((var1 ...) (var2 ...))]
|
||||
[tl-pat identifier (tl-pat-ele ...)]
|
||||
[tl-pat-ele tl-pat (code:line tl-pat ... (code:comment "a literal ellipsis"))])]{
|
||||
|
@ -739,9 +739,9 @@ defines a reduction relation for the lambda-calculus above.
|
|||
@defform/none[#:literals (with reduction-relation)
|
||||
(reduction-relation
|
||||
language
|
||||
(arrow-var #, @|ttpattern| #, @|tttterm|) ...
|
||||
(arrow-var @#,ttpattern @#,tttterm) ...
|
||||
with
|
||||
[(arrow #, @|ttpattern| #, @|tttterm|)
|
||||
[(arrow @#,ttpattern @#,tttterm)
|
||||
(arrow-var var var)] ...)]{
|
||||
|
||||
Defines a reduction relation with shortcuts. As above, the
|
||||
|
@ -881,12 +881,12 @@ all non-GUI portions of Redex) and also exported by
|
|||
@defform/subs[#:literals (: ->)
|
||||
(define-metafunction language-exp
|
||||
contract
|
||||
[(name #, @|ttpattern| ...) #, @|tttterm| extras ...]
|
||||
[(name @#,ttpattern ...) @#,tttterm extras ...]
|
||||
...)
|
||||
([contract (code:line)
|
||||
(code:line id : #, @|ttpattern| ... -> #, @|ttpattern|)]
|
||||
(code:line id : @#,ttpattern ... -> @#,ttpattern)]
|
||||
[extras (side-condition scheme-expression)
|
||||
(where tl-pat #, @|tttterm|)]
|
||||
(where tl-pat @#,tttterm)]
|
||||
[tl-pat identifier (tl-pat-ele ...)]
|
||||
[tl-pat-ele tl-pat (code:line tl-pat ... (code:comment "a literal ellipsis"))])]{
|
||||
|
||||
|
@ -965,7 +965,7 @@ match.
|
|||
|
||||
@defform[(define-metafunction/extension extending-name language-exp
|
||||
contract
|
||||
[(name #, @|ttpattern| ...) #, @|tttterm| (side-condition scheme-expression) ...]
|
||||
[(name @#,ttpattern ...) @#,tttterm (side-condition scheme-expression) ...]
|
||||
...)]{
|
||||
|
||||
This defines a metafunction as an extension of an existing
|
||||
|
@ -974,7 +974,7 @@ patterns were in this definitions, with the name of the
|
|||
function fixed up to be @scheme[extending-name].
|
||||
}
|
||||
|
||||
@defform[(in-domain? (metafunction-name #, @|tttterm| ...))]{
|
||||
@defform[(in-domain? (metafunction-name @#,tttterm ...))]{
|
||||
Returns @scheme[#t] if the inputs specified to @scheme[metafunction-name] are
|
||||
legtimate inputs according to @scheme[metafunction-name]'s contract,
|
||||
and @scheme[#f] otherwise.
|
||||
|
@ -1069,7 +1069,7 @@ an association list mapping names to application counts.}
|
|||
(apply-reduction-relation* equals (term (+ 1 2 3)))
|
||||
(covered-cases coverage)))]
|
||||
|
||||
@defform/subs[(generate-term language #, @|ttpattern| size-exp kw-args ...)
|
||||
@defform/subs[(generate-term language @#,ttpattern size-exp kw-args ...)
|
||||
([kw-args (code:line #:attempts attempts-expr)
|
||||
(code:line #:retries retries-expr)])
|
||||
#:contracts ([size-expr natural-number/c]
|
||||
|
@ -1096,7 +1096,7 @@ argument @scheme[retries-expr] (default @scheme[100]) bounds the number of times
|
|||
@scheme[generate-term] is unable to produce a satisfying term after
|
||||
@scheme[retries-expr] attempts, it raises an error}
|
||||
|
||||
@defform/subs[(redex-check language #, @|ttpattern| property-expr kw-arg ...)
|
||||
@defform/subs[(redex-check language @#,ttpattern property-expr kw-arg ...)
|
||||
([kw-arg (code:line #:attempts attempts-expr)
|
||||
(code:line #:source metafunction)
|
||||
(code:line #:source relation-expr)
|
||||
|
|
|
@ -399,7 +399,7 @@ but within special boxes that separate explicit I/O from normal
|
|||
expressions and results. For example, evaluating
|
||||
|
||||
@schemeblock[
|
||||
#, @tt{>} (read)
|
||||
@#,tt{>} (read)
|
||||
]
|
||||
|
||||
in the interactions window produces a special box for entering input:
|
||||
|
@ -414,10 +414,10 @@ shows a new prompt, it hides the interaction box. Thus, if you type
|
|||
as follows:
|
||||
|
||||
@schemeblock[
|
||||
#, @tt{>} (read)
|
||||
#, @ioinputfont{5}
|
||||
#, @schemeresult[5]
|
||||
#, @tt{>} #, @tt{_}
|
||||
@#,tt{>} (read)
|
||||
@#,ioinputfont{5}
|
||||
@#,schemeresult[5]
|
||||
@#,tt{>} @#,tt{_}
|
||||
]
|
||||
|
||||
In this case, the first @ioinputfont{5} is the input, and the second
|
||||
|
@ -440,10 +440,10 @@ and provide the input S-expression @scheme[(1 2)], the interactions
|
|||
window ultimately appears as follows:
|
||||
|
||||
@schemeblock[
|
||||
#, @ioinputfont{(1 2)}
|
||||
#, @iooutputfont{(1 2)}
|
||||
#, @schemeresult[(1 2)]
|
||||
#, @tt{>} #, @tt{_}
|
||||
@#,ioinputfont{(1 2)}
|
||||
@#,iooutputfont{(1 2)}
|
||||
@#,schemeresult[(1 2)]
|
||||
@#,tt{>} @#,tt{_}
|
||||
]
|
||||
|
||||
In this example, @scheme[display] produces output immediately beneath
|
||||
|
@ -456,13 +456,13 @@ Entering the same program line-by-line in the interactions window
|
|||
produces a different-looking result:
|
||||
|
||||
@schemeblock[
|
||||
#, @tt{>} (define v (read))
|
||||
#, @ioinputfont{(1 2)}
|
||||
#, @tt{>} (display v)
|
||||
#, @iooutputfont{(1 2)}
|
||||
#, @tt{>} v
|
||||
#, @schemeresult[(1 2)]
|
||||
#, @tt{>} #, @tt{_}
|
||||
@#,tt{>} (define v (read))
|
||||
@#,ioinputfont{(1 2)}
|
||||
@#,tt{>} (display v)
|
||||
@#,iooutputfont{(1 2)}
|
||||
@#,tt{>} v
|
||||
@#,schemeresult[(1 2)]
|
||||
@#,tt{>} @#,tt{_}
|
||||
]
|
||||
|
||||
Depending on the input operation, you may enter more text into an
|
||||
|
@ -473,31 +473,31 @@ interaction, two values are provided in response to the first
|
|||
second @scheme[(read)]:
|
||||
|
||||
@schemeblock[
|
||||
#, @tt{>} (read)
|
||||
#, @ioinputfont{5 6}
|
||||
#, @schemeresult[5]
|
||||
#, @tt{>} (read)
|
||||
#, @schemeresult[6]
|
||||
#, @tt{>} #, @tt{_}
|
||||
@#,tt{>} (read)
|
||||
@#,ioinputfont{5 6}
|
||||
@#,schemeresult[5]
|
||||
@#,tt{>} (read)
|
||||
@#,schemeresult[6]
|
||||
@#,tt{>} @#,tt{_}
|
||||
]
|
||||
|
||||
The following example illustrates that submitting input with Return
|
||||
inserts a newline character into the input stream:
|
||||
|
||||
@schemeblock[
|
||||
#, @tt{>} (read)
|
||||
#, @ioinputfont{5}
|
||||
@#,tt{>} (read)
|
||||
@#,ioinputfont{5}
|
||||
|
||||
#, @schemeresult[5]
|
||||
#, @tt{>} (read-char)
|
||||
#, @schemeresult[#\newline]
|
||||
#, @tt{>} #, @tt{_}
|
||||
@#,schemeresult[5]
|
||||
@#,tt{>} (read-char)
|
||||
@#,schemeresult[#\newline]
|
||||
@#,tt{>} @#,tt{_}
|
||||
]
|
||||
|
||||
Within a @scheme[#, @hash-lang[] #, @schememodname[scheme]] module,
|
||||
Within a @scheme[@#,hash-lang[] @#,schememodname[scheme]] module,
|
||||
the results of top-level expression print the same as the results of
|
||||
an expression entered in the @tech{interactions window}. The reason is
|
||||
that @scheme[#, @hash-lang[] #, @schememodname[scheme]] explicitly
|
||||
that @scheme[@#,hash-lang[] @#,schememodname[scheme]] explicitly
|
||||
prints the results of top-level expressions using
|
||||
@scheme[(current-print)], and DrScheme sets @scheme[(current-print)]
|
||||
to print values in the same way as for interactions.
|
||||
|
|
|
@ -19,7 +19,7 @@ is immediately imported. For example, @scheme[ptr-equal?] can never
|
|||
cause memory corruption or an invalid memory access, so it is
|
||||
immediately available on import.
|
||||
|
||||
Use @scheme[(#, @indexed-scheme[unsafe!])] at the top-level of a
|
||||
Use @scheme[(@#,indexed-scheme[unsafe!])] at the top-level of a
|
||||
module that imports @schememodname[scheme/foreign] to make unsafe
|
||||
features accessible. (For additional safety, the @scheme[unsafe!] is
|
||||
itself protected; see @secref[#:doc '(lib
|
||||
|
|
|
@ -211,13 +211,13 @@ For general information on C-level memory management with PLT Scheme,
|
|||
see @|InsideMzScheme|.
|
||||
|
||||
@defproc[(malloc [bytes-or-type (or/c exact-nonnegative-integer? ctype?)]
|
||||
[type-or-bytes (or/c exact-nonnegative-integer? ctype?) #, @elem{absent}]
|
||||
[cptr cpointer? #, @elem{absent}]
|
||||
[type-or-bytes (or/c exact-nonnegative-integer? ctype?) @#,elem{absent}]
|
||||
[cptr cpointer? @#,elem{absent}]
|
||||
[mode (one-of/c 'nonatomic 'stubborn 'uncollectable
|
||||
'eternal 'interior 'atomic-interior
|
||||
'raw)
|
||||
#, @elem{absent}]
|
||||
[fail-mode (one-of/c 'failok) #, @elem{absent}])
|
||||
@#,elem{absent}]
|
||||
[fail-mode (one-of/c 'failok) @#,elem{absent}])
|
||||
cpointer?]{
|
||||
|
||||
Allocates a memory block of a specified size using a specified
|
||||
|
@ -319,7 +319,7 @@ string that you should free. Here is an attempt at creating a suitable type:
|
|||
@schemeblock[
|
||||
(define bytes/free
|
||||
(make-ctype _pointer
|
||||
#f (code:comment #, @t{a Scheme bytes can be used as a pointer})
|
||||
#f (code:comment @#,t{a Scheme bytes can be used as a pointer})
|
||||
(lambda (x)
|
||||
(let ([b (make-byte-string x)])
|
||||
(register-finalizer x free)
|
||||
|
@ -336,7 +336,7 @@ for debugging:
|
|||
@schemeblock[
|
||||
(define bytes/free
|
||||
(make-ctype _pointer
|
||||
#f (code:comment #, @t{a Scheme bytes can be used as a pointer})
|
||||
#f (code:comment @#,t{a Scheme bytes can be used as a pointer})
|
||||
(lambda (x)
|
||||
(let ([b (make-byte-string x)])
|
||||
(register-finalizer b
|
||||
|
|
|
@ -781,7 +781,7 @@ work:
|
|||
(define makeB
|
||||
(get-ffi-obj 'makeB "foo.so"
|
||||
(_fun -> (_list-struct (_list-struct _int _byte) _int))))
|
||||
(makeB) (code:comment #, @t{should return @scheme['((1 2) 3)]})
|
||||
(makeB) (code:comment @#,t{should return @scheme['((1 2) 3)]})
|
||||
]
|
||||
|
||||
The problem here is that @cpp{makeB} returns a pointer to the struct rather
|
||||
|
@ -801,10 +801,10 @@ define a type for @cpp{A} which makes it possible to use @cpp{makeA}:
|
|||
(define-cstruct #,(schemeidfont "_A") ([x _int] [y _byte]))
|
||||
(define makeA
|
||||
(get-ffi-obj 'makeA "foo.so"
|
||||
(_fun -> #,(schemeidfont "_A-pointer")))) (code:comment #, @t{using @schemeidfont{_A} is a memory-corrupting bug!})
|
||||
(_fun -> #,(schemeidfont "_A-pointer")))) (code:comment @#,t{using @schemeidfont{_A} is a memory-corrupting bug!})
|
||||
(define a (makeA))
|
||||
(list a (A-x a) (A-y a))
|
||||
(code:comment #, @t{produces an @scheme[A] containing @scheme[1] and @scheme[2]})
|
||||
(code:comment @#,t{produces an @scheme[A] containing @scheme[1] and @scheme[2]})
|
||||
]
|
||||
|
||||
Using @cpp{gety} is also simple:
|
||||
|
@ -813,7 +813,7 @@ Using @cpp{gety} is also simple:
|
|||
(define gety
|
||||
(get-ffi-obj 'gety "foo.so"
|
||||
(_fun #,(schemeidfont "_A-pointer") -> _byte)))
|
||||
(gety a) (code:comment #, @t{produces @scheme[2]})
|
||||
(gety a) (code:comment @#,t{produces @scheme[2]})
|
||||
]
|
||||
|
||||
We now define another C struct for @cpp{B}, and expose @cpp{makeB}
|
||||
|
|
|
@ -539,7 +539,7 @@ framework)) @(require (for-label scheme/gui)) @(require
|
|||
|
||||
|
||||
|
||||
Calls @scheme[(make-object #, @method[frame:editor<%> get-editor%])].
|
||||
Calls @scheme[(make-object @#,method[frame:editor<%> get-editor%])].
|
||||
|
||||
}
|
||||
@defmethod*[(((revert) void))]{
|
||||
|
|
|
@ -17,7 +17,7 @@ program on top of the @scheme[scheme/gui] library.
|
|||
|
||||
@itemize[
|
||||
|
||||
@item{@scheme[(require #, @schememodname[framework])]
|
||||
@item{@scheme[(require @#,schememodname[framework])]
|
||||
|
||||
This library provides all of the definitions and syntax
|
||||
described in this manual.
|
||||
|
@ -45,19 +45,19 @@ program on top of the @scheme[scheme/gui] library.
|
|||
@item{
|
||||
@bold{Test Suite Engine}
|
||||
|
||||
@scheme[(require #, @schememodname[framework/test])]
|
||||
@scheme[(require @#,schememodname[framework/test])]
|
||||
|
||||
This library provides all of the definitions beginning with
|
||||
@scheme[test:] described in this manual.
|
||||
}
|
||||
@item{ @bold{GUI Utilities}
|
||||
@scheme[(require #, @schememodname[framework/gui-utils])]
|
||||
@scheme[(require @#,schememodname[framework/gui-utils])]
|
||||
|
||||
This libraries provides all of the definitions beginning
|
||||
with @scheme[gui-utils:] described in this manual.
|
||||
}
|
||||
@item{ @bold{Preferences}
|
||||
@scheme[(require #, @schememodname[framework/preferences])]
|
||||
@scheme[(require @#,schememodname[framework/preferences])]
|
||||
|
||||
This library provides a subset of the names of the
|
||||
@tt{framework.ss} library, namely those for
|
||||
|
|
|
@ -11,187 +11,187 @@ The global @indexed-scheme[the-color-database] object is an instance of
|
|||
The following colors are in the database:
|
||||
|
||||
@schemeblock[
|
||||
#, @colorName[#"Orange Red" #"OrangeRed" 255 69 0]
|
||||
#, @colorName[#"OrangeRed" #"OrangeRed" 255 69 0]
|
||||
#, @colorName[#"Tomato" #"Tomato" 255 99 71]
|
||||
#, @colorName[#"DarkRed" #"DarkRed" 139 0 0]
|
||||
#, @colorName[#"Red" #"Red" 255 0 0]
|
||||
#, @colorName[#"Firebrick" #"Firebrick" 178 34 34]
|
||||
#, @colorName[#"Crimson" #"Crimson" 220 20 60]
|
||||
#, @colorName[#"DeepPink" #"DeepPink" 255 20 147]
|
||||
#, @colorName[#"Maroon" #"Maroon" 176 48 96]
|
||||
#, @colorName[#"Indian Red" #"IndianRed" 205 92 92]
|
||||
#, @colorName[#"IndianRed" #"IndianRed" 205 92 92]
|
||||
#, @colorName[#"Medium Violet Red" #"MediumVioletRed" 199 21 133]
|
||||
#, @colorName[#"MediumVioletRed" #"MediumVioletRed" 199 21 133]
|
||||
#, @colorName[#"Violet Red" #"VioletRed" 208 32 144]
|
||||
#, @colorName[#"VioletRed" #"VioletRed" 208 32 144]
|
||||
#, @colorName[#"LightCoral" #"LightCoral" 240 128 128]
|
||||
#, @colorName[#"HotPink" #"HotPink" 255 105 180]
|
||||
#, @colorName[#"PaleVioletRed" #"PaleVioletRed" 219 112 147]
|
||||
#, @colorName[#"LightPink" #"LightPink" 255 182 193]
|
||||
#, @colorName[#"RosyBrown" #"RosyBrown" 188 143 143]
|
||||
#, @colorName[#"Pink" #"Pink" 255 192 203]
|
||||
#, @colorName[#"Orchid" #"Orchid" 218 112 214]
|
||||
#, @colorName[#"LavenderBlush" #"LavenderBlush" 255 240 245]
|
||||
#, @colorName[#"Snow" #"Snow" 255 250 250]
|
||||
#, @colorName[#"Chocolate" #"Chocolate" 210 105 30]
|
||||
#, @colorName[#"SaddleBrown" #"SaddleBrown" 139 69 19]
|
||||
#, @colorName[#"Brown" #"Brown" 132 60 36]
|
||||
#, @colorName[#"DarkOrange" #"DarkOrange" 255 140 0]
|
||||
#, @colorName[#"Coral" #"Coral" 255 127 80]
|
||||
#, @colorName[#"Sienna" #"Sienna" 160 82 45]
|
||||
#, @colorName[#"Orange" #"Orange" 255 165 0]
|
||||
#, @colorName[#"Salmon" #"Salmon" 250 128 114]
|
||||
#, @colorName[#"Peru" #"Peru" 205 133 63]
|
||||
#, @colorName[#"DarkGoldenrod" #"DarkGoldenrod" 184 134 11]
|
||||
#, @colorName[#"Goldenrod" #"Goldenrod" 218 165 32]
|
||||
#, @colorName[#"SandyBrown" #"SandyBrown" 244 164 96]
|
||||
#, @colorName[#"LightSalmon" #"LightSalmon" 255 160 122]
|
||||
#, @colorName[#"DarkSalmon" #"DarkSalmon" 233 150 122]
|
||||
#, @colorName[#"Gold" #"Gold" 255 215 0]
|
||||
#, @colorName[#"Yellow" #"Yellow" 255 255 0]
|
||||
#, @colorName[#"Olive" #"Olive" 128 128 0]
|
||||
#, @colorName[#"Burlywood" #"Burlywood" 222 184 135]
|
||||
#, @colorName[#"Tan" #"Tan" 210 180 140]
|
||||
#, @colorName[#"NavajoWhite" #"NavajoWhite" 255 222 173]
|
||||
#, @colorName[#"PeachPuff" #"PeachPuff" 255 218 185]
|
||||
#, @colorName[#"Khaki" #"Khaki" 240 230 140]
|
||||
#, @colorName[#"DarkKhaki" #"DarkKhaki" 189 183 107]
|
||||
#, @colorName[#"Moccasin" #"Moccasin" 255 228 181]
|
||||
#, @colorName[#"Wheat" #"Wheat" 245 222 179]
|
||||
#, @colorName[#"Bisque" #"Bisque" 255 228 196]
|
||||
#, @colorName[#"PaleGoldenrod" #"PaleGoldenrod" 238 232 170]
|
||||
#, @colorName[#"BlanchedAlmond" #"BlanchedAlmond" 255 235 205]
|
||||
#, @colorName[#"Medium Goldenrod" #"MediumGoldenrod" 234 234 173]
|
||||
#, @colorName[#"MediumGoldenrod" #"MediumGoldenrod" 234 234 173]
|
||||
#, @colorName[#"PapayaWhip" #"PapayaWhip" 255 239 213]
|
||||
#, @colorName[#"MistyRose" #"MistyRose" 255 228 225]
|
||||
#, @colorName[#"LemonChiffon" #"LemonChiffon" 255 250 205]
|
||||
#, @colorName[#"AntiqueWhite" #"AntiqueWhite" 250 235 215]
|
||||
#, @colorName[#"Cornsilk" #"Cornsilk" 255 248 220]
|
||||
#, @colorName[#"LightGoldenrodYellow" #"LightGoldenrodYellow" 250 250 210]
|
||||
#, @colorName[#"OldLace" #"OldLace" 253 245 230]
|
||||
#, @colorName[#"Linen" #"Linen" 250 240 230]
|
||||
#, @colorName[#"LightYellow" #"LightYellow" 255 255 224]
|
||||
#, @colorName[#"SeaShell" #"SeaShell" 255 245 238]
|
||||
#, @colorName[#"Beige" #"Beige" 245 245 220]
|
||||
#, @colorName[#"FloralWhite" #"FloralWhite" 255 250 240]
|
||||
#, @colorName[#"Ivory" #"Ivory" 255 255 240]
|
||||
#, @colorName[#"Green" #"Green" 0 255 0]
|
||||
#, @colorName[#"LawnGreen" #"LawnGreen" 124 252 0]
|
||||
#, @colorName[#"Chartreuse" #"Chartreuse" 127 255 0]
|
||||
#, @colorName[#"Green Yellow" #"GreenYellow" 173 255 47]
|
||||
#, @colorName[#"GreenYellow" #"GreenYellow" 173 255 47]
|
||||
#, @colorName[#"Yellow Green" #"YellowGreen" 154 205 50]
|
||||
#, @colorName[#"YellowGreen" #"YellowGreen" 154 205 50]
|
||||
#, @colorName[#"Medium Forest Green" #"MediumForestGreen" 107 142 35]
|
||||
#, @colorName[#"OliveDrab" #"OliveDrab" 107 142 35]
|
||||
#, @colorName[#"MediumForestGreen" #"MediumForestGreen" 107 142 35]
|
||||
#, @colorName[#"Dark Olive Green" #"DarkOliveGreen" 85 107 47]
|
||||
#, @colorName[#"DarkOliveGreen" #"DarkOliveGreen" 85 107 47]
|
||||
#, @colorName[#"DarkSeaGreen" #"DarkSeaGreen" 143 188 139]
|
||||
#, @colorName[#"Lime" #"Lime" 0 255 0]
|
||||
#, @colorName[#"Dark Green" #"DarkGreen" 0 100 0]
|
||||
#, @colorName[#"DarkGreen" #"DarkGreen" 0 100 0]
|
||||
#, @colorName[#"Lime Green" #"LimeGreen" 50 205 50]
|
||||
#, @colorName[#"LimeGreen" #"LimeGreen" 50 205 50]
|
||||
#, @colorName[#"Forest Green" #"ForestGreen" 34 139 34]
|
||||
#, @colorName[#"ForestGreen" #"ForestGreen" 34 139 34]
|
||||
#, @colorName[#"Spring Green" #"SpringGreen" 0 255 127]
|
||||
#, @colorName[#"SpringGreen" #"SpringGreen" 0 255 127]
|
||||
#, @colorName[#"Medium Spring Green" #"MediumSpringGreen" 0 250 154]
|
||||
#, @colorName[#"MediumSpringGreen" #"MediumSpringGreen" 0 250 154]
|
||||
#, @colorName[#"Sea Green" #"SeaGreen" 46 139 87]
|
||||
#, @colorName[#"SeaGreen" #"SeaGreen" 46 139 87]
|
||||
#, @colorName[#"Medium Sea Green" #"MediumSeaGreen" 60 179 113]
|
||||
#, @colorName[#"MediumSeaGreen" #"MediumSeaGreen" 60 179 113]
|
||||
#, @colorName[#"Aquamarine" #"Aquamarine" 112 216 144]
|
||||
#, @colorName[#"LightGreen" #"LightGreen" 144 238 144]
|
||||
#, @colorName[#"Pale Green" #"PaleGreen" 152 251 152]
|
||||
#, @colorName[#"PaleGreen" #"PaleGreen" 152 251 152]
|
||||
#, @colorName[#"Medium Aquamarine" #"MediumAquamarine" 102 205 170]
|
||||
#, @colorName[#"MediumAquamarine" #"MediumAquamarine" 102 205 170]
|
||||
#, @colorName[#"Turquoise" #"Turquoise" 64 224 208]
|
||||
#, @colorName[#"LightSeaGreen" #"LightSeaGreen" 32 178 170]
|
||||
#, @colorName[#"Medium Turquoise" #"MediumTurquoise" 72 209 204]
|
||||
#, @colorName[#"MediumTurquoise" #"MediumTurquoise" 72 209 204]
|
||||
#, @colorName[#"Honeydew" #"Honeydew" 240 255 240]
|
||||
#, @colorName[#"MintCream" #"MintCream" 245 255 250]
|
||||
#, @colorName[#"RoyalBlue" #"RoyalBlue" 65 105 225]
|
||||
#, @colorName[#"DodgerBlue" #"DodgerBlue" 30 144 255]
|
||||
#, @colorName[#"DeepSkyBlue" #"DeepSkyBlue" 0 191 255]
|
||||
#, @colorName[#"CornflowerBlue" #"CornflowerBlue" 100 149 237]
|
||||
#, @colorName[#"Steel Blue" #"SteelBlue" 70 130 180]
|
||||
#, @colorName[#"SteelBlue" #"SteelBlue" 70 130 180]
|
||||
#, @colorName[#"LightSkyBlue" #"LightSkyBlue" 135 206 250]
|
||||
#, @colorName[#"Dark Turquoise" #"DarkTurquoise" 0 206 209]
|
||||
#, @colorName[#"DarkTurquoise" #"DarkTurquoise" 0 206 209]
|
||||
#, @colorName[#"Cyan" #"Cyan" 0 255 255]
|
||||
#, @colorName[#"Aqua" #"Aqua" 0 255 255]
|
||||
#, @colorName[#"DarkCyan" #"DarkCyan" 0 139 139]
|
||||
#, @colorName[#"Teal" #"Teal" 0 128 128]
|
||||
#, @colorName[#"Sky Blue" #"SkyBlue" 135 206 235]
|
||||
#, @colorName[#"SkyBlue" #"SkyBlue" 135 206 235]
|
||||
#, @colorName[#"Cadet Blue" #"CadetBlue" 96 160 160]
|
||||
#, @colorName[#"CadetBlue" #"CadetBlue" 95 158 160]
|
||||
#, @colorName[#"Dark Slate Gray" #"DarkSlateGray" 47 79 79]
|
||||
#, @colorName[#"DarkSlateGray" #"DarkSlateGray" 47 79 79]
|
||||
#, @colorName[#"LightSlateGray" #"LightSlateGray" 119 136 153]
|
||||
#, @colorName[#"SlateGray" #"SlateGray" 112 128 144]
|
||||
#, @colorName[#"Light Steel Blue" #"LightSteelBlue" 176 196 222]
|
||||
#, @colorName[#"LightSteelBlue" #"LightSteelBlue" 176 196 222]
|
||||
#, @colorName[#"Light Blue" #"LightBlue" 173 216 230]
|
||||
#, @colorName[#"LightBlue" #"LightBlue" 173 216 230]
|
||||
#, @colorName[#"PowderBlue" #"PowderBlue" 176 224 230]
|
||||
#, @colorName[#"PaleTurquoise" #"PaleTurquoise" 175 238 238]
|
||||
#, @colorName[#"LightCyan" #"LightCyan" 224 255 255]
|
||||
#, @colorName[#"AliceBlue" #"AliceBlue" 240 248 255]
|
||||
#, @colorName[#"Azure" #"Azure" 240 255 255]
|
||||
#, @colorName[#"Medium Blue" #"MediumBlue" 0 0 205]
|
||||
#, @colorName[#"MediumBlue" #"MediumBlue" 0 0 205]
|
||||
#, @colorName[#"DarkBlue" #"DarkBlue" 0 0 139]
|
||||
#, @colorName[#"Midnight Blue" #"MidnightBlue" 25 25 112]
|
||||
#, @colorName[#"MidnightBlue" #"MidnightBlue" 25 25 112]
|
||||
#, @colorName[#"Navy" #"Navy" 36 36 140]
|
||||
#, @colorName[#"Blue" #"Blue" 0 0 255]
|
||||
#, @colorName[#"Indigo" #"Indigo" 75 0 130]
|
||||
#, @colorName[#"Blue Violet" #"BlueViolet" 138 43 226]
|
||||
#, @colorName[#"BlueViolet" #"BlueViolet" 138 43 226]
|
||||
#, @colorName[#"Medium Slate Blue" #"MediumSlateBlue" 123 104 238]
|
||||
#, @colorName[#"MediumSlateBlue" #"MediumSlateBlue" 123 104 238]
|
||||
#, @colorName[#"Slate Blue" #"SlateBlue" 106 90 205]
|
||||
#, @colorName[#"SlateBlue" #"SlateBlue" 106 90 205]
|
||||
#, @colorName[#"Purple" #"Purple" 160 32 240]
|
||||
#, @colorName[#"Dark Slate Blue" #"DarkSlateBlue" 72 61 139]
|
||||
#, @colorName[#"DarkSlateBlue" #"DarkSlateBlue" 72 61 139]
|
||||
#, @colorName[#"DarkViolet" #"DarkViolet" 148 0 211]
|
||||
#, @colorName[#"Dark Orchid" #"DarkOrchid" 153 50 204]
|
||||
#, @colorName[#"DarkOrchid" #"DarkOrchid" 153 50 204]
|
||||
#, @colorName[#"MediumPurple" #"MediumPurple" 147 112 219]
|
||||
#, @colorName[#"Cornflower Blue" #"CornflowerBlue" 68 64 108]
|
||||
#, @colorName[#"Medium Orchid" #"MediumOrchid" 186 85 211]
|
||||
#, @colorName[#"MediumOrchid" #"MediumOrchid" 186 85 211]
|
||||
#, @colorName[#"Magenta" #"Magenta" 255 0 255]
|
||||
#, @colorName[#"Fuchsia" #"Fuchsia" 255 0 255]
|
||||
#, @colorName[#"DarkMagenta" #"DarkMagenta" 139 0 139]
|
||||
#, @colorName[#"Violet" #"Violet" 238 130 238]
|
||||
#, @colorName[#"Plum" #"Plum" 221 160 221]
|
||||
#, @colorName[#"Lavender" #"Lavender" 230 230 250]
|
||||
#, @colorName[#"Thistle" #"Thistle" 216 191 216]
|
||||
#, @colorName[#"GhostWhite" #"GhostWhite" 248 248 255]
|
||||
#, @colorName[#"White" #"White" 255 255 255]
|
||||
#, @colorName[#"WhiteSmoke" #"WhiteSmoke" 245 245 245]
|
||||
#, @colorName[#"Gainsboro" #"Gainsboro" 220 220 220]
|
||||
#, @colorName[#"Light Gray" #"LightGray" 211 211 211]
|
||||
#, @colorName[#"LightGray" #"LightGray" 211 211 211]
|
||||
#, @colorName[#"Silver" #"Silver" 192 192 192]
|
||||
#, @colorName[#"Gray" #"Gray" 190 190 190]
|
||||
#, @colorName[#"Dark Gray" #"DarkGray" 169 169 169]
|
||||
#, @colorName[#"DarkGray" #"DarkGray" 169 169 169]
|
||||
#, @colorName[#"Dim Gray" #"DimGray" 105 105 105]
|
||||
#, @colorName[#"DimGray" #"DimGray" 105 105 105]
|
||||
#, @colorName[#"Black" #"Black" 0 0 0]
|
||||
@#,colorName[#"Orange Red" #"OrangeRed" 255 69 0]
|
||||
@#,colorName[#"OrangeRed" #"OrangeRed" 255 69 0]
|
||||
@#,colorName[#"Tomato" #"Tomato" 255 99 71]
|
||||
@#,colorName[#"DarkRed" #"DarkRed" 139 0 0]
|
||||
@#,colorName[#"Red" #"Red" 255 0 0]
|
||||
@#,colorName[#"Firebrick" #"Firebrick" 178 34 34]
|
||||
@#,colorName[#"Crimson" #"Crimson" 220 20 60]
|
||||
@#,colorName[#"DeepPink" #"DeepPink" 255 20 147]
|
||||
@#,colorName[#"Maroon" #"Maroon" 176 48 96]
|
||||
@#,colorName[#"Indian Red" #"IndianRed" 205 92 92]
|
||||
@#,colorName[#"IndianRed" #"IndianRed" 205 92 92]
|
||||
@#,colorName[#"Medium Violet Red" #"MediumVioletRed" 199 21 133]
|
||||
@#,colorName[#"MediumVioletRed" #"MediumVioletRed" 199 21 133]
|
||||
@#,colorName[#"Violet Red" #"VioletRed" 208 32 144]
|
||||
@#,colorName[#"VioletRed" #"VioletRed" 208 32 144]
|
||||
@#,colorName[#"LightCoral" #"LightCoral" 240 128 128]
|
||||
@#,colorName[#"HotPink" #"HotPink" 255 105 180]
|
||||
@#,colorName[#"PaleVioletRed" #"PaleVioletRed" 219 112 147]
|
||||
@#,colorName[#"LightPink" #"LightPink" 255 182 193]
|
||||
@#,colorName[#"RosyBrown" #"RosyBrown" 188 143 143]
|
||||
@#,colorName[#"Pink" #"Pink" 255 192 203]
|
||||
@#,colorName[#"Orchid" #"Orchid" 218 112 214]
|
||||
@#,colorName[#"LavenderBlush" #"LavenderBlush" 255 240 245]
|
||||
@#,colorName[#"Snow" #"Snow" 255 250 250]
|
||||
@#,colorName[#"Chocolate" #"Chocolate" 210 105 30]
|
||||
@#,colorName[#"SaddleBrown" #"SaddleBrown" 139 69 19]
|
||||
@#,colorName[#"Brown" #"Brown" 132 60 36]
|
||||
@#,colorName[#"DarkOrange" #"DarkOrange" 255 140 0]
|
||||
@#,colorName[#"Coral" #"Coral" 255 127 80]
|
||||
@#,colorName[#"Sienna" #"Sienna" 160 82 45]
|
||||
@#,colorName[#"Orange" #"Orange" 255 165 0]
|
||||
@#,colorName[#"Salmon" #"Salmon" 250 128 114]
|
||||
@#,colorName[#"Peru" #"Peru" 205 133 63]
|
||||
@#,colorName[#"DarkGoldenrod" #"DarkGoldenrod" 184 134 11]
|
||||
@#,colorName[#"Goldenrod" #"Goldenrod" 218 165 32]
|
||||
@#,colorName[#"SandyBrown" #"SandyBrown" 244 164 96]
|
||||
@#,colorName[#"LightSalmon" #"LightSalmon" 255 160 122]
|
||||
@#,colorName[#"DarkSalmon" #"DarkSalmon" 233 150 122]
|
||||
@#,colorName[#"Gold" #"Gold" 255 215 0]
|
||||
@#,colorName[#"Yellow" #"Yellow" 255 255 0]
|
||||
@#,colorName[#"Olive" #"Olive" 128 128 0]
|
||||
@#,colorName[#"Burlywood" #"Burlywood" 222 184 135]
|
||||
@#,colorName[#"Tan" #"Tan" 210 180 140]
|
||||
@#,colorName[#"NavajoWhite" #"NavajoWhite" 255 222 173]
|
||||
@#,colorName[#"PeachPuff" #"PeachPuff" 255 218 185]
|
||||
@#,colorName[#"Khaki" #"Khaki" 240 230 140]
|
||||
@#,colorName[#"DarkKhaki" #"DarkKhaki" 189 183 107]
|
||||
@#,colorName[#"Moccasin" #"Moccasin" 255 228 181]
|
||||
@#,colorName[#"Wheat" #"Wheat" 245 222 179]
|
||||
@#,colorName[#"Bisque" #"Bisque" 255 228 196]
|
||||
@#,colorName[#"PaleGoldenrod" #"PaleGoldenrod" 238 232 170]
|
||||
@#,colorName[#"BlanchedAlmond" #"BlanchedAlmond" 255 235 205]
|
||||
@#,colorName[#"Medium Goldenrod" #"MediumGoldenrod" 234 234 173]
|
||||
@#,colorName[#"MediumGoldenrod" #"MediumGoldenrod" 234 234 173]
|
||||
@#,colorName[#"PapayaWhip" #"PapayaWhip" 255 239 213]
|
||||
@#,colorName[#"MistyRose" #"MistyRose" 255 228 225]
|
||||
@#,colorName[#"LemonChiffon" #"LemonChiffon" 255 250 205]
|
||||
@#,colorName[#"AntiqueWhite" #"AntiqueWhite" 250 235 215]
|
||||
@#,colorName[#"Cornsilk" #"Cornsilk" 255 248 220]
|
||||
@#,colorName[#"LightGoldenrodYellow" #"LightGoldenrodYellow" 250 250 210]
|
||||
@#,colorName[#"OldLace" #"OldLace" 253 245 230]
|
||||
@#,colorName[#"Linen" #"Linen" 250 240 230]
|
||||
@#,colorName[#"LightYellow" #"LightYellow" 255 255 224]
|
||||
@#,colorName[#"SeaShell" #"SeaShell" 255 245 238]
|
||||
@#,colorName[#"Beige" #"Beige" 245 245 220]
|
||||
@#,colorName[#"FloralWhite" #"FloralWhite" 255 250 240]
|
||||
@#,colorName[#"Ivory" #"Ivory" 255 255 240]
|
||||
@#,colorName[#"Green" #"Green" 0 255 0]
|
||||
@#,colorName[#"LawnGreen" #"LawnGreen" 124 252 0]
|
||||
@#,colorName[#"Chartreuse" #"Chartreuse" 127 255 0]
|
||||
@#,colorName[#"Green Yellow" #"GreenYellow" 173 255 47]
|
||||
@#,colorName[#"GreenYellow" #"GreenYellow" 173 255 47]
|
||||
@#,colorName[#"Yellow Green" #"YellowGreen" 154 205 50]
|
||||
@#,colorName[#"YellowGreen" #"YellowGreen" 154 205 50]
|
||||
@#,colorName[#"Medium Forest Green" #"MediumForestGreen" 107 142 35]
|
||||
@#,colorName[#"OliveDrab" #"OliveDrab" 107 142 35]
|
||||
@#,colorName[#"MediumForestGreen" #"MediumForestGreen" 107 142 35]
|
||||
@#,colorName[#"Dark Olive Green" #"DarkOliveGreen" 85 107 47]
|
||||
@#,colorName[#"DarkOliveGreen" #"DarkOliveGreen" 85 107 47]
|
||||
@#,colorName[#"DarkSeaGreen" #"DarkSeaGreen" 143 188 139]
|
||||
@#,colorName[#"Lime" #"Lime" 0 255 0]
|
||||
@#,colorName[#"Dark Green" #"DarkGreen" 0 100 0]
|
||||
@#,colorName[#"DarkGreen" #"DarkGreen" 0 100 0]
|
||||
@#,colorName[#"Lime Green" #"LimeGreen" 50 205 50]
|
||||
@#,colorName[#"LimeGreen" #"LimeGreen" 50 205 50]
|
||||
@#,colorName[#"Forest Green" #"ForestGreen" 34 139 34]
|
||||
@#,colorName[#"ForestGreen" #"ForestGreen" 34 139 34]
|
||||
@#,colorName[#"Spring Green" #"SpringGreen" 0 255 127]
|
||||
@#,colorName[#"SpringGreen" #"SpringGreen" 0 255 127]
|
||||
@#,colorName[#"Medium Spring Green" #"MediumSpringGreen" 0 250 154]
|
||||
@#,colorName[#"MediumSpringGreen" #"MediumSpringGreen" 0 250 154]
|
||||
@#,colorName[#"Sea Green" #"SeaGreen" 46 139 87]
|
||||
@#,colorName[#"SeaGreen" #"SeaGreen" 46 139 87]
|
||||
@#,colorName[#"Medium Sea Green" #"MediumSeaGreen" 60 179 113]
|
||||
@#,colorName[#"MediumSeaGreen" #"MediumSeaGreen" 60 179 113]
|
||||
@#,colorName[#"Aquamarine" #"Aquamarine" 112 216 144]
|
||||
@#,colorName[#"LightGreen" #"LightGreen" 144 238 144]
|
||||
@#,colorName[#"Pale Green" #"PaleGreen" 152 251 152]
|
||||
@#,colorName[#"PaleGreen" #"PaleGreen" 152 251 152]
|
||||
@#,colorName[#"Medium Aquamarine" #"MediumAquamarine" 102 205 170]
|
||||
@#,colorName[#"MediumAquamarine" #"MediumAquamarine" 102 205 170]
|
||||
@#,colorName[#"Turquoise" #"Turquoise" 64 224 208]
|
||||
@#,colorName[#"LightSeaGreen" #"LightSeaGreen" 32 178 170]
|
||||
@#,colorName[#"Medium Turquoise" #"MediumTurquoise" 72 209 204]
|
||||
@#,colorName[#"MediumTurquoise" #"MediumTurquoise" 72 209 204]
|
||||
@#,colorName[#"Honeydew" #"Honeydew" 240 255 240]
|
||||
@#,colorName[#"MintCream" #"MintCream" 245 255 250]
|
||||
@#,colorName[#"RoyalBlue" #"RoyalBlue" 65 105 225]
|
||||
@#,colorName[#"DodgerBlue" #"DodgerBlue" 30 144 255]
|
||||
@#,colorName[#"DeepSkyBlue" #"DeepSkyBlue" 0 191 255]
|
||||
@#,colorName[#"CornflowerBlue" #"CornflowerBlue" 100 149 237]
|
||||
@#,colorName[#"Steel Blue" #"SteelBlue" 70 130 180]
|
||||
@#,colorName[#"SteelBlue" #"SteelBlue" 70 130 180]
|
||||
@#,colorName[#"LightSkyBlue" #"LightSkyBlue" 135 206 250]
|
||||
@#,colorName[#"Dark Turquoise" #"DarkTurquoise" 0 206 209]
|
||||
@#,colorName[#"DarkTurquoise" #"DarkTurquoise" 0 206 209]
|
||||
@#,colorName[#"Cyan" #"Cyan" 0 255 255]
|
||||
@#,colorName[#"Aqua" #"Aqua" 0 255 255]
|
||||
@#,colorName[#"DarkCyan" #"DarkCyan" 0 139 139]
|
||||
@#,colorName[#"Teal" #"Teal" 0 128 128]
|
||||
@#,colorName[#"Sky Blue" #"SkyBlue" 135 206 235]
|
||||
@#,colorName[#"SkyBlue" #"SkyBlue" 135 206 235]
|
||||
@#,colorName[#"Cadet Blue" #"CadetBlue" 96 160 160]
|
||||
@#,colorName[#"CadetBlue" #"CadetBlue" 95 158 160]
|
||||
@#,colorName[#"Dark Slate Gray" #"DarkSlateGray" 47 79 79]
|
||||
@#,colorName[#"DarkSlateGray" #"DarkSlateGray" 47 79 79]
|
||||
@#,colorName[#"LightSlateGray" #"LightSlateGray" 119 136 153]
|
||||
@#,colorName[#"SlateGray" #"SlateGray" 112 128 144]
|
||||
@#,colorName[#"Light Steel Blue" #"LightSteelBlue" 176 196 222]
|
||||
@#,colorName[#"LightSteelBlue" #"LightSteelBlue" 176 196 222]
|
||||
@#,colorName[#"Light Blue" #"LightBlue" 173 216 230]
|
||||
@#,colorName[#"LightBlue" #"LightBlue" 173 216 230]
|
||||
@#,colorName[#"PowderBlue" #"PowderBlue" 176 224 230]
|
||||
@#,colorName[#"PaleTurquoise" #"PaleTurquoise" 175 238 238]
|
||||
@#,colorName[#"LightCyan" #"LightCyan" 224 255 255]
|
||||
@#,colorName[#"AliceBlue" #"AliceBlue" 240 248 255]
|
||||
@#,colorName[#"Azure" #"Azure" 240 255 255]
|
||||
@#,colorName[#"Medium Blue" #"MediumBlue" 0 0 205]
|
||||
@#,colorName[#"MediumBlue" #"MediumBlue" 0 0 205]
|
||||
@#,colorName[#"DarkBlue" #"DarkBlue" 0 0 139]
|
||||
@#,colorName[#"Midnight Blue" #"MidnightBlue" 25 25 112]
|
||||
@#,colorName[#"MidnightBlue" #"MidnightBlue" 25 25 112]
|
||||
@#,colorName[#"Navy" #"Navy" 36 36 140]
|
||||
@#,colorName[#"Blue" #"Blue" 0 0 255]
|
||||
@#,colorName[#"Indigo" #"Indigo" 75 0 130]
|
||||
@#,colorName[#"Blue Violet" #"BlueViolet" 138 43 226]
|
||||
@#,colorName[#"BlueViolet" #"BlueViolet" 138 43 226]
|
||||
@#,colorName[#"Medium Slate Blue" #"MediumSlateBlue" 123 104 238]
|
||||
@#,colorName[#"MediumSlateBlue" #"MediumSlateBlue" 123 104 238]
|
||||
@#,colorName[#"Slate Blue" #"SlateBlue" 106 90 205]
|
||||
@#,colorName[#"SlateBlue" #"SlateBlue" 106 90 205]
|
||||
@#,colorName[#"Purple" #"Purple" 160 32 240]
|
||||
@#,colorName[#"Dark Slate Blue" #"DarkSlateBlue" 72 61 139]
|
||||
@#,colorName[#"DarkSlateBlue" #"DarkSlateBlue" 72 61 139]
|
||||
@#,colorName[#"DarkViolet" #"DarkViolet" 148 0 211]
|
||||
@#,colorName[#"Dark Orchid" #"DarkOrchid" 153 50 204]
|
||||
@#,colorName[#"DarkOrchid" #"DarkOrchid" 153 50 204]
|
||||
@#,colorName[#"MediumPurple" #"MediumPurple" 147 112 219]
|
||||
@#,colorName[#"Cornflower Blue" #"CornflowerBlue" 68 64 108]
|
||||
@#,colorName[#"Medium Orchid" #"MediumOrchid" 186 85 211]
|
||||
@#,colorName[#"MediumOrchid" #"MediumOrchid" 186 85 211]
|
||||
@#,colorName[#"Magenta" #"Magenta" 255 0 255]
|
||||
@#,colorName[#"Fuchsia" #"Fuchsia" 255 0 255]
|
||||
@#,colorName[#"DarkMagenta" #"DarkMagenta" 139 0 139]
|
||||
@#,colorName[#"Violet" #"Violet" 238 130 238]
|
||||
@#,colorName[#"Plum" #"Plum" 221 160 221]
|
||||
@#,colorName[#"Lavender" #"Lavender" 230 230 250]
|
||||
@#,colorName[#"Thistle" #"Thistle" 216 191 216]
|
||||
@#,colorName[#"GhostWhite" #"GhostWhite" 248 248 255]
|
||||
@#,colorName[#"White" #"White" 255 255 255]
|
||||
@#,colorName[#"WhiteSmoke" #"WhiteSmoke" 245 245 245]
|
||||
@#,colorName[#"Gainsboro" #"Gainsboro" 220 220 220]
|
||||
@#,colorName[#"Light Gray" #"LightGray" 211 211 211]
|
||||
@#,colorName[#"LightGray" #"LightGray" 211 211 211]
|
||||
@#,colorName[#"Silver" #"Silver" 192 192 192]
|
||||
@#,colorName[#"Gray" #"Gray" 190 190 190]
|
||||
@#,colorName[#"Dark Gray" #"DarkGray" 169 169 169]
|
||||
@#,colorName[#"DarkGray" #"DarkGray" 169 169 169]
|
||||
@#,colorName[#"Dim Gray" #"DimGray" 105 105 105]
|
||||
@#,colorName[#"DimGray" #"DimGray" 105 105 105]
|
||||
@#,colorName[#"Black" #"Black" 0 0 0]
|
||||
]
|
||||
|
||||
The names are not case-sensitive.
|
||||
|
|
|
@ -35,23 +35,23 @@ The following example creates a frame with a drawing canvas, and then
|
|||
mouth:
|
||||
|
||||
@schemeblock[
|
||||
(code:comment #, @t{Make a 300 x 300 frame})
|
||||
(code:comment @#,t{Make a 300 x 300 frame})
|
||||
(define frame (new frame% [label "Drawing Example"]
|
||||
[width 300]
|
||||
[height 300]))
|
||||
(code:comment #, @t{Make the drawing area})
|
||||
(code:comment @#,t{Make the drawing area})
|
||||
(define canvas (new canvas% [parent frame]))
|
||||
(code:comment #, @t{Get the canvas's drawing context})
|
||||
(code:comment @#,t{Get the canvas's drawing context})
|
||||
(define dc (send canvas #,(:: canvas<%> get-dc)))
|
||||
|
||||
(code:comment #, @t{Make some pens and brushes})
|
||||
(code:comment @#,t{Make some pens and brushes})
|
||||
(define no-pen (make-object pen% "BLACK" 1 'transparent))
|
||||
(define no-brush (make-object brush% "BLACK" 'transparent))
|
||||
(define blue-brush (make-object brush% "BLUE" 'solid))
|
||||
(define yellow-brush (make-object brush% "YELLOW" 'solid))
|
||||
(define red-pen (make-object pen% "RED" 2 'solid))
|
||||
|
||||
(code:comment #, @t{Define a procedure to draw a face})
|
||||
(code:comment @#,t{Define a procedure to draw a face})
|
||||
(define (draw-face dc)
|
||||
(send dc #,(:: dc<%> set-pen) no-pen)
|
||||
(send dc #,(:: dc<%> set-brush) blue-brush)
|
||||
|
@ -66,11 +66,11 @@ The following example creates a frame with a drawing canvas, and then
|
|||
(let ([-pi (atan 0 -1)])
|
||||
(send dc #,(:: dc<%> draw-arc) 75 75 150 150 (* 5/4 -pi) (* 7/4 -pi))))
|
||||
|
||||
(code:comment #, @t{Show the frame})
|
||||
(code:comment @#,t{Show the frame})
|
||||
(send frame #,(:: top-level-window<%> show) #t)
|
||||
(code:comment #, @t{Wait a second to let the window get ready})
|
||||
(code:comment @#,t{Wait a second to let the window get ready})
|
||||
(sleep/yield 1)
|
||||
(code:comment #, @t{Draw the face})
|
||||
(code:comment @#,t{Draw the face})
|
||||
(draw-face dc)
|
||||
]
|
||||
|
||||
|
@ -92,20 +92,20 @@ One second is plenty of time for the frame to show itself, but a
|
|||
the canvas:
|
||||
|
||||
@schemeblock[
|
||||
(code:comment #, @t{Make a 300 x 300 frame})
|
||||
(code:comment @#,t{Make a 300 x 300 frame})
|
||||
(define frame (new frame% [label "Drawing Example"]
|
||||
[width 300]
|
||||
[height 300]))
|
||||
|
||||
(code:comment #, @t{Make the drawing area with a paint callback})
|
||||
(code:comment @#,t{Make the drawing area with a paint callback})
|
||||
(define canvas
|
||||
(new canvas% [parent frame]
|
||||
[paint-callback
|
||||
(lambda (canvas dc) (draw-face dc))]))
|
||||
|
||||
(code:comment #, @t{... pens, brushes, and @scheme[draw-face] are the same as above ...})
|
||||
(code:comment @#,t{... pens, brushes, and @scheme[draw-face] are the same as above ...})
|
||||
|
||||
(code:comment #, @t{Show the frame})
|
||||
(code:comment @#,t{Show the frame})
|
||||
(send frame #,(:: top-level-window<%> show) #t)
|
||||
]
|
||||
|
||||
|
@ -118,31 +118,31 @@ Suppose that @scheme[draw-face] creates a particularly complex face that
|
|||
bitmap:
|
||||
|
||||
@schemeblock[
|
||||
(code:comment #, @t{... pens, brushes, and @scheme[draw-face] are the same as above ...})
|
||||
(code:comment @#,t{... pens, brushes, and @scheme[draw-face] are the same as above ...})
|
||||
|
||||
(code:comment #, @t{Create a 300 x 300 bitmap})
|
||||
(code:comment @#,t{Create a 300 x 300 bitmap})
|
||||
(define face-bitmap (make-object bitmap% 300 300))
|
||||
(code:comment #, @t{Create a drawing context for the bitmap})
|
||||
(code:comment @#,t{Create a drawing context for the bitmap})
|
||||
(define bm-dc (make-object bitmap-dc% face-bitmap))
|
||||
(code:comment #, @t{A bitmap's initial content is undefined; clear it before drawing})
|
||||
(code:comment @#,t{A bitmap's initial content is undefined; clear it before drawing})
|
||||
(send bm-dc #,(:: dc<%> clear))
|
||||
|
||||
(code:comment #, @t{Draw the face into the bitmap})
|
||||
(code:comment @#,t{Draw the face into the bitmap})
|
||||
(draw-face bm-dc)
|
||||
|
||||
(code:comment #, @t{Make a 300 x 300 frame})
|
||||
(code:comment @#,t{Make a 300 x 300 frame})
|
||||
(define frame (new frame% [label "Drawing Example"]
|
||||
[width 300]
|
||||
[height 300]))
|
||||
|
||||
(code:comment #, @t{Make a drawing area whose paint callback copies the bitmap})
|
||||
(code:comment @#,t{Make a drawing area whose paint callback copies the bitmap})
|
||||
(define canvas
|
||||
(new canvas% [parent frame]
|
||||
[paint-callback
|
||||
(lambda (canvas dc)
|
||||
(send dc #,(:: dc<%> draw-bitmap) face-bitmap 0 0))]))
|
||||
|
||||
(code:comment #, @t{Show the frame})
|
||||
(code:comment @#,t{Show the frame})
|
||||
(send frame #,(:: top-level-window<%> show) #t)
|
||||
]
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ We can insert the old text editor (which we recently removed from the
|
|||
creating an editor snip:
|
||||
|
||||
@schemeblock[
|
||||
(define s (make-object editor-snip% t)) (code:comment #, @t{@scheme[t] is the old text editor})
|
||||
(define s (make-object editor-snip% t)) (code:comment @#,t{@scheme[t] is the old text editor})
|
||||
(send pb #,(:: editor<%> insert) s)
|
||||
]
|
||||
|
||||
|
@ -128,7 +128,7 @@ An individual snip cannot be inserted into different editors at the
|
|||
same time, or inserted multiple times in the same editor:
|
||||
|
||||
@schemeblock[
|
||||
(send pb #,(:: editor<%> insert) s) (code:comment #, @t{no effect})
|
||||
(send pb #,(:: editor<%> insert) s) (code:comment @#,t{no effect})
|
||||
]
|
||||
|
||||
However, we can make a deep copy of the snip and insert the copy into
|
||||
|
|
|
@ -250,9 +250,9 @@ If the event does not correspond to a complete shortcut combination,
|
|||
Returns the result of
|
||||
|
||||
@schemeblock[
|
||||
(or (send this #, @method[frame% on-menu-char] event)
|
||||
(send this #, @method[top-level-window<%> on-system-menu-char] event)
|
||||
(send this #, @method[top-level-window<%> on-traverse-char] event))
|
||||
(or (send this @#,method[frame% on-menu-char] event)
|
||||
(send this @#,method[top-level-window<%> on-system-menu-char] event)
|
||||
(send this @#,method[top-level-window<%> on-traverse-char] event))
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
@ -103,13 +103,13 @@ For a text field, the most useful methods of a @scheme[text%] object
|
|||
are the following:
|
||||
@itemize[
|
||||
|
||||
@item{@scheme[(send a-text #, @method[text% get-text])] returns
|
||||
@item{@scheme[(send a-text @#,method[text% get-text])] returns
|
||||
the current text of the editor.}
|
||||
|
||||
@item{@scheme[(send a-text #, @method[text% erase])] deletes all text from
|
||||
@item{@scheme[(send a-text @#,method[text% erase])] deletes all text from
|
||||
the editor.}
|
||||
|
||||
@item{@scheme[(send a-text #, @method[text% insert] _str)] inserts
|
||||
@item{@scheme[(send a-text @#,method[text% insert] _str)] inserts
|
||||
@scheme[_str] into the editor at the current caret position.}
|
||||
|
||||
]
|
||||
|
|
|
@ -12,10 +12,10 @@ The PLT Scheme windowing toolbox provides the basic building blocks of GUI
|
|||
@scheme[frame%] class:
|
||||
|
||||
@schemeblock[
|
||||
(code:comment #, @t{Make a frame by instantiating the @scheme[frame%] class})
|
||||
(code:comment @#,t{Make a frame by instantiating the @scheme[frame%] class})
|
||||
(define frame (new frame% [label "Example"]))
|
||||
|
||||
(code:comment #, @t{Show the frame by calling its @method[top-level-window<%> show] method})
|
||||
(code:comment @#,t{Show the frame by calling its @method[top-level-window<%> show] method})
|
||||
(send frame #,(:: top-level-window<%> show) #t)
|
||||
]
|
||||
|
||||
|
@ -27,21 +27,21 @@ The built-in classes provide various mechanisms for handling GUI
|
|||
clicks the button, the message changes:
|
||||
|
||||
@schemeblock[
|
||||
(code:comment #, @t{Make a frame by instantiating the @scheme[frame%] class})
|
||||
(code:comment @#,t{Make a frame by instantiating the @scheme[frame%] class})
|
||||
(define frame (new frame% [label "Example"]))
|
||||
|
||||
(code:comment #, @t{Make a static text message in the frame})
|
||||
(code:comment @#,t{Make a static text message in the frame})
|
||||
(define msg (new message% [parent frame]
|
||||
[label "No events so far..."]))
|
||||
|
||||
(code:comment #, @t{Make a button in the frame})
|
||||
(code:comment @#,t{Make a button in the frame})
|
||||
(new button% [parent frame]
|
||||
[label "Click Me"]
|
||||
(code:comment #, @t{Callback procedure for a button click:})
|
||||
(code:comment @#,t{Callback procedure for a button click:})
|
||||
(callback (lambda (button event)
|
||||
(send msg #,(method message% set-label) "Button click"))))
|
||||
|
||||
(code:comment #, @t{Show the frame by calling its @scheme[show] method})
|
||||
(code:comment @#,t{Show the frame by calling its @scheme[show] method})
|
||||
(send frame #,(:: top-level-window<%> show) #t)
|
||||
]
|
||||
|
||||
|
@ -63,19 +63,19 @@ If a window receives multiple kinds of events, the events are
|
|||
that handles mouse and keyboard events:
|
||||
|
||||
@schemeblock[
|
||||
(code:comment #, @t{Derive a new canvas (a drawing window) class to handle events})
|
||||
(code:comment @#,t{Derive a new canvas (a drawing window) class to handle events})
|
||||
(define my-canvas%
|
||||
(class canvas% (code:comment #, @t{The base class is @scheme[canvas%]})
|
||||
(code:comment #, @t{Define overriding method to handle mouse events})
|
||||
(class canvas% (code:comment @#,t{The base class is @scheme[canvas%]})
|
||||
(code:comment @#,t{Define overriding method to handle mouse events})
|
||||
(define/override (#,(:: canvas<%> on-event) event)
|
||||
(send msg #,(:: message% set-label) "Canvas mouse"))
|
||||
(code:comment #, @t{Define overriding method to handle keyboard events})
|
||||
(code:comment @#,t{Define overriding method to handle keyboard events})
|
||||
(define/override (#,(:: canvas<%> on-char) event)
|
||||
(send msg #,(:: message% set-label) "Canvas keyboard"))
|
||||
(code:comment #, @t{Call the superclass init, passing on all init args})
|
||||
(code:comment @#,t{Call the superclass init, passing on all init args})
|
||||
(super-new)))
|
||||
|
||||
(code:comment #, @t{Make a canvas that handles events in the frame})
|
||||
(code:comment @#,t{Make a canvas that handles events in the frame})
|
||||
(new my-canvas% [parent frame])
|
||||
]
|
||||
|
||||
|
@ -344,23 +344,23 @@ The built-in container classes include horizontal panels (and panes),
|
|||
with the following program:
|
||||
|
||||
@schemeblock[
|
||||
(code:comment #, @t{Create a dialog})
|
||||
(code:comment @#,t{Create a dialog})
|
||||
(define dialog (instantiate dialog% ("Example")))
|
||||
|
||||
(code:comment #, @t{Add a text field to the dialog})
|
||||
(code:comment @#,t{Add a text field to the dialog})
|
||||
(new text-field% [parent dialog] [label "Your name"])
|
||||
|
||||
(code:comment #, @t{Add a horizontal panel to the dialog, with centering for buttons})
|
||||
(code:comment @#,t{Add a horizontal panel to the dialog, with centering for buttons})
|
||||
(define panel (new horizontal-panel% [parent dialog]
|
||||
[alignment '(center center)]))
|
||||
|
||||
(code:comment #, @t{Add @onscreen{Cancel} and @onscreen{Ok} buttons to the horizontal panel})
|
||||
(code:comment @#,t{Add @onscreen{Cancel} and @onscreen{Ok} buttons to the horizontal panel})
|
||||
(new button% [parent panel] [label "Cancel"])
|
||||
(new button% [parent panel] [label "Ok"])
|
||||
(when (system-position-ok-before-cancel?)
|
||||
(send panel #,(:: area-container<%> change-children) reverse))
|
||||
|
||||
(code:comment #, @t{Show the dialog})
|
||||
(code:comment @#,t{Show the dialog})
|
||||
(send dialog #,(:: dialog% show) #t)
|
||||
]
|
||||
|
||||
|
@ -883,7 +883,7 @@ Whenever the system dispatches an event, the call to the handler
|
|||
|
||||
@def+int[
|
||||
(define (block f)
|
||||
(code:comment #, @t{calls @scheme[f] and returns void if @scheme[f] tries to escape})
|
||||
(code:comment @#,t{calls @scheme[f] and returns void if @scheme[f] tries to escape})
|
||||
(let ([done? #f])
|
||||
(let/ec k
|
||||
(dynamic-wind
|
||||
|
|
|
@ -89,13 +89,13 @@ result, a function that takes a list of arguments cannot directly
|
|||
apply a function like @scheme[+] to all of the items in the list:
|
||||
|
||||
@def+int[
|
||||
(define (avg lst) (code:comment #, @elem{doesn't work...})
|
||||
(define (avg lst) (code:comment @#,elem{doesn't work...})
|
||||
(/ (+ lst) (length lst)))
|
||||
(avg '(1 2 3))
|
||||
]
|
||||
|
||||
@def+int[
|
||||
(define (avg lst) (code:comment #, @elem{doesn't always work...})
|
||||
(define (avg lst) (code:comment @#,elem{doesn't always work...})
|
||||
(/ (+ (list-ref lst 0) (list-ref lst 1) (list-ref lst 2))
|
||||
(length lst)))
|
||||
(avg '(1 2 3))
|
||||
|
|
|
@ -75,7 +75,7 @@ shadowed.
|
|||
|
||||
@examples[
|
||||
define
|
||||
(eval:alts (let ([#, @schemeidfont{define} 5]) #, @schemeidfont{define}) (let ([define 5]) define))
|
||||
(eval:alts (let ([@#,schemeidfont{define} 5]) @#,schemeidfont{define}) (let ([define 5]) define))
|
||||
]
|
||||
|
||||
Shadowing standard bindings in this way is rarely a good idea, but the
|
||||
|
|
|
@ -47,9 +47,9 @@ UTF-8-decoded form of the output.
|
|||
|
||||
@examples[
|
||||
(display #"Apple")
|
||||
(eval:alts (code:line (display #, @schemevalfont{"\316\273"}) (code:comment #, @t{same as @scheme["\316\273"]}))
|
||||
(eval:alts (code:line (display @#,schemevalfont{"\316\273"}) (code:comment @#,t{same as @scheme["\316\273"]}))
|
||||
(display "\316\273"))
|
||||
(code:line (display #"\316\273") (code:comment #, @t{UTF-8 encoding of @elem["\u03BB"]}))
|
||||
(code:line (display #"\316\273") (code:comment @#,t{UTF-8 encoding of @elem["\u03BB"]}))
|
||||
]
|
||||
|
||||
For explicitly converting between strings and byte strings, Scheme
|
||||
|
@ -62,9 +62,9 @@ arbitrary string encodings.
|
|||
(bytes->string/utf-8 #"\316\273")
|
||||
(bytes->string/latin-1 #"\316\273")
|
||||
(code:line
|
||||
(parameterize ([current-locale "C"]) (code:comment #, @elem{C locale supports ASCII,})
|
||||
(bytes->string/locale #"\316\273")) (code:comment #, @elem{only, so...}))
|
||||
(let ([cvt (bytes-open-converter "cp1253" (code:comment #, @elem{Greek code page})
|
||||
(parameterize ([current-locale "C"]) (code:comment @#,elem{C locale supports ASCII,})
|
||||
(bytes->string/locale #"\316\273")) (code:comment @#,elem{only, so...}))
|
||||
(let ([cvt (bytes-open-converter "cp1253" (code:comment @#,elem{Greek code page})
|
||||
"UTF-8")]
|
||||
[dest (make-bytes 2)])
|
||||
(bytes-convert cvt #"\353" 0 1 dest)
|
||||
|
|
|
@ -18,7 +18,7 @@ expands to a use of @scheme[unchecked-go]:
|
|||
(module m mzscheme
|
||||
(provide go)
|
||||
(define (unchecked-go n x)
|
||||
(code:comment #, @t{to avoid disaster, @scheme[n] must be a number})
|
||||
(code:comment @#,t{to avoid disaster, @scheme[n] must be a number})
|
||||
(+ n 17))
|
||||
(define-syntax (go stx)
|
||||
(syntax-case stx ()
|
||||
|
|
|
@ -23,11 +23,11 @@ to the string-constant syntax used to print a string result.
|
|||
|
||||
@examples[
|
||||
"Apple"
|
||||
(eval:alts #, @schemevalfont{"\u03BB"} "\u03BB")
|
||||
(eval:alts @#,schemevalfont{"\u03BB"} "\u03BB")
|
||||
(display "Apple")
|
||||
(display "a \"quoted\" thing")
|
||||
(display "two\nlines")
|
||||
(eval:alts (display #, @schemevalfont{"\u03BB"}) (display "\u03BB"))
|
||||
(eval:alts (display @#,schemevalfont{"\u03BB"}) (display "\u03BB"))
|
||||
]
|
||||
|
||||
A string can be mutable or immutable; strings written directly as
|
||||
|
|
|
@ -32,7 +32,7 @@ and linefeed characters print as @scheme[#\space] and
|
|||
(integer->char 65)
|
||||
(char->integer #\A)
|
||||
#\u03BB
|
||||
(eval:alts #, @schemevalfont["#\\u03BB"] #\u03BB)
|
||||
(eval:alts @#,schemevalfont["#\\u03BB"] #\u03BB)
|
||||
(integer->char 17)
|
||||
(char->integer #\space)
|
||||
]
|
||||
|
|
|
@ -79,7 +79,7 @@ non-@scheme[#f] value from its @scheme[expr]s. As a special case,
|
|||
(define (got-milk? lst)
|
||||
(and (not (null? lst))
|
||||
(or (eq? 'milk (car lst))
|
||||
(got-milk? (cdr lst))))) (code:comment #, @t{recurs only if needed}))
|
||||
(got-milk? (cdr lst))))) (code:comment @#,t{recurs only if needed}))
|
||||
(got-milk? '(apple banana))
|
||||
(got-milk? '(apple milk banana))
|
||||
]
|
||||
|
|
|
@ -74,8 +74,8 @@ Take a look at this excerpt from a string-processing module, inspired by the
|
|||
scheme
|
||||
|
||||
(provide/contract
|
||||
(code:comment #, @t{pad the given str left and right with})
|
||||
(code:comment #, @t{the (optional) char so that it is centered})
|
||||
(code:comment @#,t{pad the given str left and right with})
|
||||
(code:comment @#,t{the (optional) char so that it is centered})
|
||||
[string-pad-center (->* (string? natural-number/c)
|
||||
(char?)
|
||||
string?)])
|
||||
|
|
|
@ -114,7 +114,7 @@ predicate:
|
|||
(car 17))
|
||||
(eval:alts ; `examples' doesn't catch break exceptions!
|
||||
(with-handlers ([exn:fail? (lambda (v) 'oops)])
|
||||
(break-thread (current-thread)) (code:comment #, @t{simulate Ctl-C})
|
||||
(break-thread (current-thread)) (code:comment @#,t{simulate Ctl-C})
|
||||
(car 17))
|
||||
(error "user break"))
|
||||
]
|
||||
|
@ -203,7 +203,7 @@ changing @scheme[0] to grab the continuation before returning 0:
|
|||
(define saved-k #f)
|
||||
(define (save-it!)
|
||||
(call-with-composable-continuation
|
||||
(lambda (k) (code:comment #, @t{@scheme[k] is the captured continuation})
|
||||
(lambda (k) (code:comment @#,t{@scheme[k] is the captured continuation})
|
||||
(set! saved-k k)
|
||||
0)))
|
||||
(+ 1 (+ 1 (+ 1 (save-it!))))
|
||||
|
|
|
@ -218,15 +218,15 @@ keyword, @scheme[prop:equal+hash], and then a list of three functions:
|
|||
#:property
|
||||
prop:equal+hash
|
||||
(list (lambda (a b equal?-recur)
|
||||
(code:comment #, @t{compare @scheme[a] and @scheme[b]})
|
||||
(code:comment @#,t{compare @scheme[a] and @scheme[b]})
|
||||
(and (equal?-recur (lead-width a) (lead-width b))
|
||||
(equal?-recur (lead-height a) (lead-height b))))
|
||||
(lambda (a hash-recur)
|
||||
(code:comment #, @t{compute primary hash code of @scheme[a]})
|
||||
(code:comment @#,t{compute primary hash code of @scheme[a]})
|
||||
(+ (hash-recur (lead-width a))
|
||||
(* 3 (hash-recur (lead-height a)))))
|
||||
(lambda (a hash2-recur)
|
||||
(code:comment #, @t{compute secondary hash code of @scheme[a]})
|
||||
(code:comment @#,t{compute secondary hash code of @scheme[a]})
|
||||
(+ (hash2-recur (lead-width a))
|
||||
(hash2-recur (lead-height a))))))
|
||||
(equal? (make-lead 1 2) (make-lead 1 2))
|
||||
|
@ -343,7 +343,7 @@ than the one with a single field:
|
|||
@interaction[
|
||||
#:eval posn-eval
|
||||
(sprout? #s(sprout bean #f 17))
|
||||
(code:line (define-struct sprout (kind yummy? count) #:prefab) (code:comment #, @t{redefine}))
|
||||
(code:line (define-struct sprout (kind yummy? count) #:prefab) (code:comment @#,t{redefine}))
|
||||
(sprout? #s(sprout bean #f 17))
|
||||
(sprout? lunch)
|
||||
]
|
||||
|
|
|
@ -128,7 +128,7 @@ The full syntax of the function shorthand for @scheme[define] is as follows:
|
|||
([head id
|
||||
(head args)]
|
||||
[args (code:line arg ...)
|
||||
(code:line arg ... #, @schemeparenfont{.} rest-id)])]{}
|
||||
(code:line arg ... @#,schemeparenfont{.} rest-id)])]{}
|
||||
|
||||
The expansion of this shorthand has one nested @scheme[lambda] form
|
||||
for each @scheme[_head] in the definition, where the innermost
|
||||
|
@ -212,18 +212,18 @@ For example, the syntax of @scheme[lambda] is
|
|||
so the following are valid instances of the grammar:
|
||||
|
||||
@schemeblock[
|
||||
(lambda (f) (code:comment #, @elem{no definitions})
|
||||
(lambda (f) (code:comment @#,elem{no definitions})
|
||||
(printf "running\n")
|
||||
(f 0))
|
||||
|
||||
(lambda (f) (code:comment #, @elem{one definition})
|
||||
(lambda (f) (code:comment @#,elem{one definition})
|
||||
(define (log-it what)
|
||||
(printf "~a\n"))
|
||||
(log-it "running")
|
||||
(f 0)
|
||||
(log-it "done"))
|
||||
|
||||
(lambda (f n) (code:comment #, @elem{two definitions})
|
||||
(lambda (f n) (code:comment @#,elem{two definitions})
|
||||
(define (call n)
|
||||
(if (zero? n)
|
||||
(log-it "done")
|
||||
|
|
|
@ -43,15 +43,15 @@ PLT Scheme tools in their default modes do not conform to @|r5rs|,
|
|||
mainly because PLT Scheme tools generally expect modules, and @|r5rs|
|
||||
does not define a module system. Typical single-file @|r5rs| programs
|
||||
can be converted to PLT Scheme programs by prefixing them with
|
||||
@scheme[#, @hash-lang[] #, @schememodname[r5rs]], but other Scheme
|
||||
systems do not recognize @scheme[#, @hash-lang[] #,
|
||||
@schememodname[r5rs]]. The @exec{plt-r5rs} executable (see
|
||||
@scheme[@#,hash-lang[] @#,schememodname[r5rs]], but other Scheme
|
||||
systems do not recognize @scheme[@#,hash-lang[]
|
||||
@#,schememodname[r5rs]]. The @exec{plt-r5rs} executable (see
|
||||
@secref[#:doc '(lib "r5rs/r5rs.scrbl") "plt-r5rs"]) more directly
|
||||
conforms to the @|r5rs| standard.
|
||||
|
||||
Aside from the module system, the syntactic forms and functions of
|
||||
@|r5rs| and PLT Scheme differ. Only simple @|r5rs| become PLT Scheme
|
||||
programs when prefixed with @scheme[#, @hash-lang[] scheme], and
|
||||
programs when prefixed with @scheme[@#,hash-lang[] scheme], and
|
||||
relatively few PLT Scheme programs become @|r5rs| programs when a
|
||||
@hash-lang[] line is removed. Also, when mixing ``@|r5rs| modules''
|
||||
with PLT Scheme modules, beware that @|r5rs| pairs correspond to PLT
|
||||
|
@ -119,7 +119,7 @@ including the following:
|
|||
|
||||
Each of these languages is used by starting module with the language
|
||||
name after @hash-lang[]. For example, this source of this
|
||||
document starts with @scheme[#, @hash-lang[] scribble/doc].
|
||||
document starts with @scheme[@#,hash-lang[] scribble/doc].
|
||||
|
||||
PLT Scheme users can define their own languages. A language name maps
|
||||
to its implementation through a module path by adding
|
||||
|
@ -134,11 +134,11 @@ Some language names act as language loaders. For example,
|
|||
@schememodname[s-exp] as a language uses the usual PLT Scheme parser
|
||||
for surface-syntax reading, and then it uses the module path after
|
||||
@schememodname[s-exp] for the language's syntactic forms. Thus,
|
||||
@scheme[#, @hash-lang[] #, @schememodname[s-exp] "mylang.ss"] parses
|
||||
@scheme[@#,hash-lang[] @#,schememodname[s-exp] "mylang.ss"] parses
|
||||
the module body using the normal PLT Scheme reader, by then imports
|
||||
the initial syntax and functions for the module body from
|
||||
@scheme["mylang.ss"]. Similarly, @scheme[#, @hash-lang[] #,
|
||||
@schememodname[planet] _planet-path] loads a language via
|
||||
@scheme["mylang.ss"]. Similarly, @scheme[@#,hash-lang[]
|
||||
@#,schememodname[planet] _planet-path] loads a language via
|
||||
@seclink["top" #:doc '(lib "planet/planet.scrbl")]{@|PLaneT|}.
|
||||
|
||||
@; --------------------------------------------------
|
||||
|
|
|
@ -421,14 +421,14 @@ fast-parallel-seq (in-parallel fast-seq ...)
|
|||
|
||||
@examples[
|
||||
(time (for ([i (in-range 100000)])
|
||||
(for ([elem (in-list '(a b c d e f g h))]) (code:comment #, @elem{fast})
|
||||
(for ([elem (in-list '(a b c d e f g h))]) (code:comment @#,elem{fast})
|
||||
(void))))
|
||||
(time (for ([i (in-range 100000)])
|
||||
(for ([elem '(a b c d e f g h)]) (code:comment #, @elem{slower})
|
||||
(for ([elem '(a b c d e f g h)]) (code:comment @#,elem{slower})
|
||||
(void))))
|
||||
(time (let ([seq (in-list '(a b c d e f g h))])
|
||||
(for ([i (in-range 100000)])
|
||||
(for ([elem seq]) (code:comment #, @elem{slower})
|
||||
(for ([elem seq]) (code:comment @#,elem{slower})
|
||||
(void)))))
|
||||
]
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ ports.
|
|||
@examples[
|
||||
#:eval io-eval
|
||||
(display "Hi")
|
||||
(code:line (display "Hi" (current-output-port)) (code:comment #, @t{the same}))
|
||||
(code:line (display "Hi" (current-output-port)) (code:comment @#,t{the same}))
|
||||
]
|
||||
|
||||
If you start the @exec{mzscheme} program in a terminal, then the
|
||||
|
|
|
@ -37,12 +37,12 @@ run-time flags and enumerations, use symbols instead of keywords. The
|
|||
example below illustrates the distinct roles of keywords and symbols.
|
||||
|
||||
@examples[
|
||||
(code:line (define dir (find-system-path 'temp-dir)) (code:comment #, @t{not @scheme['#:temp-dir]}))
|
||||
(code:line (define dir (find-system-path 'temp-dir)) (code:comment @#,t{not @scheme['#:temp-dir]}))
|
||||
(with-output-to-file (build-path dir "stuff.txt")
|
||||
(lambda () (printf "example\n"))
|
||||
(code:comment #, @t{optional @scheme[#:mode] argument can be @scheme['text] or @scheme['binary]})
|
||||
(code:comment @#,t{optional @scheme[#:mode] argument can be @scheme['text] or @scheme['binary]})
|
||||
#:mode 'text
|
||||
(code:comment #, @t{optional @scheme[#:exists] argument can be @scheme['replace], @scheme['truncate], ...})
|
||||
(code:comment @#,t{optional @scheme[#:exists] argument can be @scheme['replace], @scheme['truncate], ...})
|
||||
#:exists 'replace)
|
||||
]
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ value:
|
|||
(let ([+ (lambda (x y)
|
||||
(if (string? x)
|
||||
(string-append x y)
|
||||
(+ x y)))]) (code:comment #, @t{use original @scheme[+]})
|
||||
(+ x y)))]) (code:comment @#,t{use original @scheme[+]})
|
||||
(list (+ 1 2)
|
||||
(+ "see" "saw")))
|
||||
]
|
||||
|
|
|
@ -35,12 +35,12 @@ parentheses for expressions are brown.
|
|||
Many predefined functions operate on lists. Here are a few examples:
|
||||
|
||||
@interaction[
|
||||
(code:line (length (list "hop" "skip" "jump")) (code:comment #, @t{count the elements}))
|
||||
(code:line (list-ref (list "hop" "skip" "jump") 0) (code:comment #, @t{extract by position}))
|
||||
(code:line (length (list "hop" "skip" "jump")) (code:comment @#,t{count the elements}))
|
||||
(code:line (list-ref (list "hop" "skip" "jump") 0) (code:comment @#,t{extract by position}))
|
||||
(list-ref (list "hop" "skip" "jump") 1)
|
||||
(code:line (append (list "hop" "skip") (list "jump")) (code:comment #, @t{combine lists}))
|
||||
(code:line (reverse (list "hop" "skip" "jump")) (code:comment #, @t{reverse order}))
|
||||
(code:line (member "fall" (list "hop" "skip" "jump")) (code:comment #, @t{check for an element}))
|
||||
(code:line (append (list "hop" "skip") (list "jump")) (code:comment @#,t{combine lists}))
|
||||
(code:line (reverse (list "hop" "skip" "jump")) (code:comment @#,t{reverse order}))
|
||||
(code:line (member "fall" (list "hop" "skip" "jump")) (code:comment @#,t{check for an element}))
|
||||
]
|
||||
|
||||
@;------------------------------------------------------------------------
|
||||
|
@ -220,12 +220,12 @@ argument @scheme[len]:
|
|||
|
||||
@schemeblock[
|
||||
(define (my-length lst)
|
||||
(code:comment #, @t{local function @scheme[iter]:})
|
||||
(code:comment @#,t{local function @scheme[iter]:})
|
||||
(define (iter lst len)
|
||||
(cond
|
||||
[(empty? lst) len]
|
||||
[else (iter (rest lst) (+ len 1))]))
|
||||
(code:comment #, @t{body of @scheme[my-length] calls @scheme[iter]:})
|
||||
(code:comment @#,t{body of @scheme[my-length] calls @scheme[iter]:})
|
||||
(iter lst 0))
|
||||
]
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ scheme
|
|||
|
||||
(provide print-cake)
|
||||
|
||||
(code:comment #, @t{draws a cake with @scheme[n] candles})
|
||||
(code:comment @#,t{draws a cake with @scheme[n] candles})
|
||||
(define (print-cake n)
|
||||
(printf " ~a \n" (make-string n #\.))
|
||||
(printf " .-~a-.\n" (make-string n #\|))
|
||||
|
@ -76,9 +76,9 @@ scheme
|
|||
|
||||
(require setup/dirs)
|
||||
|
||||
(find-collects-dir) (code:comment #, @t{main collection directory})
|
||||
(find-user-collects-dir) (code:comment #, @t{user-specific collection directory})
|
||||
(get-collects-search-dirs) (code:comment #, @t{complete search path})
|
||||
(find-collects-dir) (code:comment @#,t{main collection directory})
|
||||
(find-user-collects-dir) (code:comment @#,t{user-specific collection directory})
|
||||
(get-collects-search-dirs) (code:comment @#,t{complete search path})
|
||||
]
|
||||
|
||||
We discuss more forms of module reference later in
|
||||
|
|
|
@ -116,7 +116,7 @@ is used as the path if no sub-path element is supplied.
|
|||
@examples[
|
||||
(eval:alts
|
||||
(module m (lib "scheme")
|
||||
(code:comment #, @t{Use @filepath{schematics}'s @filepath{random.plt} 1.0, file @filepath{random.ss}:})
|
||||
(code:comment @#,t{Use @filepath{schematics}'s @filepath{random.plt} 1.0, file @filepath{random.ss}:})
|
||||
(require (planet schematics/random:1/random))
|
||||
(display (random-gaussian)))
|
||||
(void))
|
||||
|
|
|
@ -156,7 +156,7 @@ explicitly and install it for the call to eval:
|
|||
scheme
|
||||
|
||||
(define ns (make-base-namespace))
|
||||
(eval '(cons 1 2) ns) (code:comment #, @t{works})
|
||||
(eval '(cons 1 2) ns) (code:comment @#,t{works})
|
||||
]
|
||||
|
||||
The @scheme[make-base-namespace] function creates a namespace that is
|
||||
|
@ -209,7 +209,7 @@ scheme
|
|||
(define x 1)
|
||||
(define y 2)
|
||||
|
||||
(eval '(cons x y) ns) (code:comment #, @t{produces @schemeresult[(1 . 2)]})
|
||||
(eval '(cons x y) ns) (code:comment @#,t{produces @schemeresult[(1 . 2)]})
|
||||
]
|
||||
|
||||
|
||||
|
@ -332,7 +332,7 @@ again will create a distinct class datatype:
|
|||
(class? object%)
|
||||
(class?
|
||||
(parameterize ([current-namespace (make-base-empty-namespace)])
|
||||
(namespace-require 'scheme/class) (code:comment #, @t{loads again})
|
||||
(namespace-require 'scheme/class) (code:comment @#,t{loads again})
|
||||
(eval 'object%)))
|
||||
]
|
||||
|
||||
|
@ -351,7 +351,7 @@ shared:
|
|||
'scheme/class
|
||||
ns)
|
||||
(parameterize ([current-namespace ns])
|
||||
(namespace-require 'scheme/class) (code:comment #, @t{uses attached})
|
||||
(namespace-require 'scheme/class) (code:comment @#,t{uses attached})
|
||||
(eval 'object%))))
|
||||
]
|
||||
|
||||
|
|
|
@ -57,8 +57,8 @@ interpretation of digits.
|
|||
|
||||
@examples[
|
||||
0.5
|
||||
(eval:alts #, @schemevalfont{#e0.5} 1/2)
|
||||
(eval:alts #, @schemevalfont{#x03BB} #x03BB)
|
||||
(eval:alts @#,schemevalfont{#e0.5} 1/2)
|
||||
(eval:alts @#,schemevalfont{#x03BB} #x03BB)
|
||||
]
|
||||
|
||||
Computations that involve an inexact number produce inexact results,
|
||||
|
@ -82,8 +82,8 @@ representing real numbers that are not rational. Scheme can represent
|
|||
only rational numbers and complex numbers with rational parts.
|
||||
|
||||
@examples[
|
||||
(code:line (sin 0) (code:comment #, @t{rational...}))
|
||||
(code:line (sin 1/2) (code:comment #, @t{not rational...}))
|
||||
(code:line (sin 0) (code:comment @#,t{rational...}))
|
||||
(code:line (sin 1/2) (code:comment @#,t{not rational...}))
|
||||
]
|
||||
|
||||
In terms of performance, computations with small integers are
|
||||
|
|
|
@ -160,8 +160,8 @@ so that
|
|||
|
||||
@schemeblock[
|
||||
(let ([red 1] [green 2] [blue 3])
|
||||
(rotate red green) (code:comment #, @t{swaps})
|
||||
(rotate red green blue) (code:comment #, @t{rotates left})
|
||||
(rotate red green) (code:comment @#,t{swaps})
|
||||
(rotate red green blue) (code:comment @#,t{rotates left})
|
||||
(list red green blue))
|
||||
]
|
||||
|
||||
|
@ -395,7 +395,7 @@ module, which lets us write @scheme[define-cbr] easily enough:
|
|||
(set! actual v))
|
||||
(... ...))]))
|
||||
(define-for-cbr do-f (arg ...)
|
||||
() (code:comment #, @t{explained below...})
|
||||
() (code:comment @#,t{explained below...})
|
||||
body)))
|
||||
]
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ more typically used for symbols and lists, which have other meanings
|
|||
|
||||
An expression
|
||||
|
||||
@specform[(quote #, @schemevarfont{datum})]
|
||||
@specform[(quote @#,schemevarfont{datum})]
|
||||
|
||||
is a shorthand for
|
||||
|
||||
|
|
|
@ -519,8 +519,8 @@ is represented by @scheme[#f]
|
|||
|
||||
@interaction[
|
||||
(define date-re
|
||||
(code:comment #, @t{match `month year' or `month day, year';})
|
||||
(code:comment #, @t{subpattern matches day, if present})
|
||||
(code:comment @#,t{match `month year' or `month day, year';})
|
||||
(code:comment @#,t{subpattern matches day, if present})
|
||||
#rx"([a-z]+) +([0-9]+,)? *([0-9]+)")
|
||||
(regexp-match date-re "jan 1, 1970")
|
||||
(regexp-match date-re "jan 1970")
|
||||
|
@ -863,11 +863,11 @@ First, we define a subregexp @scheme[n0-255] that matches 0 through
|
|||
(define n0-255
|
||||
(string-append
|
||||
"(?:"
|
||||
"\\d|" (code:comment #, @t{ 0 through 9})
|
||||
"\\d\\d|" (code:comment #, @t{ 00 through 99})
|
||||
"[01]\\d\\d|" (code:comment #, @t{000 through 199})
|
||||
"2[0-4]\\d|" (code:comment #, @t{200 through 249})
|
||||
"25[0-5]" (code:comment #, @t{250 through 255})
|
||||
"\\d|" (code:comment @#,t{ 0 through 9})
|
||||
"\\d\\d|" (code:comment @#,t{ 00 through 99})
|
||||
"[01]\\d\\d|" (code:comment @#,t{000 through 199})
|
||||
"2[0-4]\\d|" (code:comment @#,t{200 through 249})
|
||||
"25[0-5]" (code:comment @#,t{250 through 255})
|
||||
")"))
|
||||
]
|
||||
|
||||
|
@ -892,14 +892,14 @@ three dots separating them.
|
|||
#:eval ex-eval
|
||||
(define ip-re1
|
||||
(string-append
|
||||
"^" (code:comment #, @t{nothing before})
|
||||
n0-255 (code:comment #, @t{the first @scheme[n0-255],})
|
||||
"(?:" (code:comment #, @t{then the subpattern of})
|
||||
"\\." (code:comment #, @t{a dot followed by})
|
||||
n0-255 (code:comment #, @t{an @scheme[n0-255],})
|
||||
")" (code:comment #, @t{which is})
|
||||
"{3}" (code:comment #, @t{repeated exactly 3 times})
|
||||
"$" (code:comment #, @t{with nothing following})
|
||||
"^" (code:comment @#,t{nothing before})
|
||||
n0-255 (code:comment @#,t{the first @scheme[n0-255],})
|
||||
"(?:" (code:comment @#,t{then the subpattern of})
|
||||
"\\." (code:comment @#,t{a dot followed by})
|
||||
n0-255 (code:comment @#,t{an @scheme[n0-255],})
|
||||
")" (code:comment @#,t{which is})
|
||||
"{3}" (code:comment @#,t{repeated exactly 3 times})
|
||||
"$" (code:comment @#,t{with nothing following})
|
||||
))
|
||||
]
|
||||
|
||||
|
@ -928,7 +928,7 @@ ensure there @emph{is} a digit other than zero.
|
|||
(define ip-re
|
||||
(pregexp
|
||||
(string-append
|
||||
"(?=.*[1-9])" (code:comment #, @t{ensure there's a non-0 digit})
|
||||
"(?=.*[1-9])" (code:comment @#,t{ensure there's a non-0 digit})
|
||||
ip-re1)))
|
||||
]
|
||||
|
||||
|
@ -940,8 +940,8 @@ composed of @emph{only} zeros and dots.
|
|||
(define ip-re
|
||||
(pregexp
|
||||
(string-append
|
||||
"(?![0.]*$)" (code:comment #, @t{not just zeros and dots})
|
||||
(code:comment #, @t{(note: @litchar{.} is not metachar inside @litchar{[}...@litchar{]})})
|
||||
"(?![0.]*$)" (code:comment @#,t{not just zeros and dots})
|
||||
(code:comment @#,t{(note: @litchar{.} is not metachar inside @litchar{[}...@litchar{]})})
|
||||
ip-re1)))
|
||||
]
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ individually to the @scheme[_id]s using @scheme[set!].
|
|||
(set! l (+ l 1)))
|
||||
(begin0
|
||||
(values w l)
|
||||
(code:comment #, @t{swap sides...})
|
||||
(code:comment @#,t{swap sides...})
|
||||
(set!-values (w l) (values l w))))))
|
||||
(game #t)
|
||||
(game #t)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
A program module is written as
|
||||
|
||||
@schemeblock[
|
||||
#, @BNF-seq[@litchar{#lang} @nonterm{langname} @kleenestar{@nonterm{topform}}]
|
||||
@#,BNF-seq[@litchar{#lang} @nonterm{langname} @kleenestar{@nonterm{topform}}]
|
||||
]
|
||||
|
||||
where a @nonterm{topform} is either a @nonterm{definition} or an
|
||||
|
@ -67,11 +67,11 @@ A definition of the form
|
|||
|
||||
@moreguide["define"]{definitions}
|
||||
|
||||
@schemeblock[#, @val-defn-stx]
|
||||
@schemeblock[@#,val-defn-stx]
|
||||
|
||||
binds @nonterm{id} to the result of @nonterm{expr}, while
|
||||
|
||||
@schemeblock[#, @fun-defn-stx]
|
||||
@schemeblock[@#,fun-defn-stx]
|
||||
|
||||
binds the first @nonterm{id} to a function (also called a
|
||||
@defterm{procedure}) that takes arguments as named by the remaining
|
||||
|
@ -81,9 +81,9 @@ the last @nonterm{expr}.
|
|||
|
||||
@defexamples[
|
||||
#:eval ex-eval
|
||||
(code:line (define pie 3) (code:comment #, @t{defines @scheme[pie] to be @scheme[3]}))
|
||||
(code:line (define (piece str) (code:comment #, @t{defines @scheme[piece] as a function})
|
||||
(substring str 0 pie)) (code:comment #, @t{ of one argument}))
|
||||
(code:line (define pie 3) (code:comment @#,t{defines @scheme[pie] to be @scheme[3]}))
|
||||
(code:line (define (piece str) (code:comment @#,t{defines @scheme[piece] as a function})
|
||||
(substring str 0 pie)) (code:comment @#,t{ of one argument}))
|
||||
pie
|
||||
(piece "key lime")
|
||||
]
|
||||
|
@ -192,12 +192,12 @@ identifiers, as opposed to arithmetic expressions. Here are several
|
|||
more examples:
|
||||
|
||||
@schemeblock[
|
||||
#, @schemeid[+]
|
||||
#, @schemeid[Hfuhruhurr]
|
||||
#, @schemeid[integer?]
|
||||
#, @schemeid[pass/fail]
|
||||
#, @schemeid[john-jacob-jingleheimer-schmidt]
|
||||
#, @schemeid[a-b-c+1-2-3]
|
||||
@#,schemeid[+]
|
||||
@#,schemeid[Hfuhruhurr]
|
||||
@#,schemeid[integer?]
|
||||
@#,schemeid[pass/fail]
|
||||
@#,schemeid[john-jacob-jingleheimer-schmidt]
|
||||
@#,schemeid[a-b-c+1-2-3]
|
||||
]
|
||||
|
||||
@;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -210,7 +210,7 @@ terminology. The syntax of a function call is
|
|||
@moreguide["application"]{function calls}
|
||||
|
||||
@schemeblock[
|
||||
#, app-expr-stx
|
||||
#,app-expr-stx
|
||||
]
|
||||
|
||||
where the number of @nonterm{expr}s determines the number of
|
||||
|
@ -225,20 +225,20 @@ pre-defined names are hyperlinked to the reference manual. So, you can
|
|||
click on an identifier to get full details about its use.
|
||||
|
||||
@interaction[
|
||||
(code:line (string-append "rope" "twine" "yarn") (code:comment #, @t{append strings}))
|
||||
(code:line (substring "corduroys" 0 4) (code:comment #, @t{extract a substring}))
|
||||
(code:line (string-length "shoelace") (code:comment #, @t{get a string's length}))
|
||||
(code:line (string? "c'est ne pas une string") (code:comment #, @t{recognize strings}))
|
||||
(code:line (string-append "rope" "twine" "yarn") (code:comment @#,t{append strings}))
|
||||
(code:line (substring "corduroys" 0 4) (code:comment @#,t{extract a substring}))
|
||||
(code:line (string-length "shoelace") (code:comment @#,t{get a string's length}))
|
||||
(code:line (string? "c'est ne pas une string") (code:comment @#,t{recognize strings}))
|
||||
(string? 1)
|
||||
(code:line (sqrt 16) (code:comment #, @t{find a square root}))
|
||||
(code:line (sqrt 16) (code:comment @#,t{find a square root}))
|
||||
(sqrt -16)
|
||||
(code:line (+ 1 2) (code:comment #, @t{add numbers}))
|
||||
(code:line (- 2 1) (code:comment #, @t{subtract numbers}))
|
||||
(code:line (< 2 1) (code:comment #, @t{compare numbers}))
|
||||
(code:line (+ 1 2) (code:comment @#,t{add numbers}))
|
||||
(code:line (- 2 1) (code:comment @#,t{subtract numbers}))
|
||||
(code:line (< 2 1) (code:comment @#,t{compare numbers}))
|
||||
(>= 2 1)
|
||||
(code:line (number? "c'est une number") (code:comment #, @t{recognize numbers}))
|
||||
(code:line (number? "c'est une number") (code:comment @#,t{recognize numbers}))
|
||||
(number? 1)
|
||||
(code:line (equal? 6 "half dozen") (code:comment #, @t{compare anything}))
|
||||
(code:line (equal? 6 "half dozen") (code:comment @#,t{compare anything}))
|
||||
(equal? 6 6)
|
||||
(equal? "half dozen" "half dozen")
|
||||
]
|
||||
|
@ -249,7 +249,7 @@ click on an identifier to get full details about its use.
|
|||
The next simplest kind of expression is an @scheme[if] conditional:
|
||||
|
||||
@schemeblock[
|
||||
#, if-expr-stx
|
||||
#,if-expr-stx
|
||||
]
|
||||
|
||||
@moreguide["conditionals"]{conditionals}
|
||||
|
@ -306,8 +306,8 @@ provides more readable shortcuts through the @scheme[and] and
|
|||
@moreguide["and+or"]{@scheme[and] and @scheme[or]}
|
||||
|
||||
@schemeblock[
|
||||
#, and-expr-stx
|
||||
#, or-expr-stx
|
||||
#,and-expr-stx
|
||||
#,or-expr-stx
|
||||
]
|
||||
|
||||
The @scheme[and] form short-circuits: it stops and returns @scheme[#f]
|
||||
|
@ -345,7 +345,7 @@ The shorthand for a sequence of tests is the @scheme[cond] form:
|
|||
@moreguide["cond"]{@scheme[cond]}
|
||||
|
||||
@schemeblock[
|
||||
#, cond-expr-stx
|
||||
#,cond-expr-stx
|
||||
]
|
||||
|
||||
A @scheme[cond] form contains a sequence of clauses between square
|
||||
|
@ -393,7 +393,7 @@ expression for the function, instead of just an @nonterm{id}:
|
|||
@moreguide["application"]{function calls}
|
||||
|
||||
@schemeblock[
|
||||
#, app2-expr-stx
|
||||
#,app2-expr-stx
|
||||
]
|
||||
|
||||
The first @nonterm{expr} is often an @nonterm{id}, such
|
||||
|
@ -462,7 +462,7 @@ identifiers for the function's arguments, and then the function's
|
|||
body expressions:
|
||||
|
||||
@schemeblock[
|
||||
#, lambda-expr-stx
|
||||
#,lambda-expr-stx
|
||||
]
|
||||
|
||||
Evaluating a @scheme[lambda] form by itself produces a function:
|
||||
|
@ -506,8 +506,8 @@ function. In other words, the @scheme[lambda]-generated function
|
|||
(twice louder "really")
|
||||
]
|
||||
|
||||
We have so far referred to definitions of the form @scheme[(define #,
|
||||
@nonterm{id} #, @nonterm{expr})] as ``non-function
|
||||
We have so far referred to definitions of the form @scheme[(define
|
||||
@#,nonterm{id} @#,nonterm{expr})] as ``non-function
|
||||
definitions.'' This characterization is misleading, because the
|
||||
@nonterm{expr} could be a @scheme[lambda] form, in which case
|
||||
the definition is equivalent to using the ``function'' definition
|
||||
|
@ -541,8 +541,8 @@ body expressions:
|
|||
@moreguide["intdefs"]{local (internal) definitions}
|
||||
|
||||
@schemeblock[
|
||||
#, fun-defn2-stx
|
||||
#, lambda2-expr-stx
|
||||
#,fun-defn2-stx
|
||||
#,lambda2-expr-stx
|
||||
]
|
||||
|
||||
Definitions at the start of a function body are local to the
|
||||
|
@ -550,8 +550,8 @@ function body.
|
|||
|
||||
@defexamples[
|
||||
(define (converse s)
|
||||
(define (starts? s2) (code:comment #, @t{local to @scheme[converse]})
|
||||
(define len2 (string-length s2)) (code:comment #, @t{local to @scheme[starts?]})
|
||||
(define (starts? s2) (code:comment @#,t{local to @scheme[converse]})
|
||||
(define len2 (string-length s2)) (code:comment @#,t{local to @scheme[starts?]})
|
||||
(and (>= (string-length s) len2)
|
||||
(equal? s2 (substring s 0 len2))))
|
||||
(cond
|
||||
|
@ -560,7 +560,7 @@ function body.
|
|||
[else "huh?"]))
|
||||
(converse "hello!")
|
||||
(converse "urp")
|
||||
(eval:alts (code:line starts? (code:comment #, @t{outside of @scheme[converse], so...}))
|
||||
(eval:alts (code:line starts? (code:comment @#,t{outside of @scheme[converse], so...}))
|
||||
(parameterize ([current-namespace (make-base-namespace)]) (eval 'starts?)))
|
||||
]
|
||||
|
||||
|
@ -572,7 +572,7 @@ of requiring a separate @scheme[define] for each identifier.
|
|||
@moreguide["intdefs"]{@scheme[let] and @scheme[let*]}
|
||||
|
||||
@schemeblock[
|
||||
#, let-expr-stx
|
||||
#,let-expr-stx
|
||||
]
|
||||
|
||||
Each binding clause is an @nonterm{id} and a
|
||||
|
|
|
@ -30,7 +30,7 @@ arrive at a symbol, but the reader preserves case by default.
|
|||
(eq? 'a (string->symbol "a"))
|
||||
(eq? 'a 'b)
|
||||
(eq? 'a 'A)
|
||||
(eval:alts #, @elem{@schemefont{#ci}@schemevalfont{'A}} #ci'A)
|
||||
(eval:alts @#,elem{@schemefont{#ci}@schemevalfont{'A}} #ci'A)
|
||||
]
|
||||
|
||||
Any string (i.e., any character sequence) can be supplied to
|
||||
|
|
|
@ -87,9 +87,9 @@ lists that prints as @schemeresult[((1) (2) (3))]. The @scheme[quote]
|
|||
form does exactly that:
|
||||
|
||||
@interaction[
|
||||
(eval:alts (#, @scheme[quote] ((1) (2) (3))) '((1) (2) (3)))
|
||||
(eval:alts (#, @scheme[quote] ("red" "green" "blue")) '("red" "green" "blue"))
|
||||
(eval:alts (#, @scheme[quote] ()) '())
|
||||
(eval:alts (@#,scheme[quote] ((1) (2) (3))) '((1) (2) (3)))
|
||||
(eval:alts (@#,scheme[quote] ("red" "green" "blue")) '("red" "green" "blue"))
|
||||
(eval:alts (@#,scheme[quote] ()) '())
|
||||
]
|
||||
|
||||
The @scheme[quote] form works with the dot notation, too, whether the
|
||||
|
@ -97,29 +97,29 @@ quoted form is normalized by the dot-parenthesis elimination rule or
|
|||
not:
|
||||
|
||||
@interaction[
|
||||
(eval:alts (#, @scheme[quote] (1 . 2)) '(1 . 2))
|
||||
(eval:alts (#, @scheme[quote] (0 #, @schemeparenfont{.} (1 . 2))) '(0 . (1 . 2)))
|
||||
(eval:alts (@#,scheme[quote] (1 . 2)) '(1 . 2))
|
||||
(eval:alts (@#,scheme[quote] (0 @#,schemeparenfont{.} (1 . 2))) '(0 . (1 . 2)))
|
||||
]
|
||||
|
||||
Naturally, lists of any kind can be nested:
|
||||
|
||||
@interaction[
|
||||
(list (list 1 2 3) 5 (list "a" "b" "c"))
|
||||
(eval:alts (#, @scheme[quote] ((1 2 3) 5 ("a" "b" "c"))) '((1 2 3) 5 ("a" "b" "c")))
|
||||
(eval:alts (@#,scheme[quote] ((1 2 3) 5 ("a" "b" "c"))) '((1 2 3) 5 ("a" "b" "c")))
|
||||
]
|
||||
|
||||
If you wrap an identifier with @scheme[quote], then you get output
|
||||
that looks like an identifier:
|
||||
|
||||
@interaction[
|
||||
(eval:alts (#, @scheme[quote] jane-doe) 'jane-doe)
|
||||
(eval:alts (@#,scheme[quote] jane-doe) 'jane-doe)
|
||||
]
|
||||
|
||||
A value that prints like an identifier is a @defterm{symbol}. In the
|
||||
same way that parenthesized output should not be confused with
|
||||
expressions, a printed symbol should not be confused with an
|
||||
identifier. In particular, the symbol @scheme[(#, @scheme[quote] #,
|
||||
@schemeidfont{map})] has nothing to do with the @schemeidfont{map}
|
||||
identifier. In particular, the symbol @scheme[(@#,scheme[quote]
|
||||
@#,schemeidfont{map})] has nothing to do with the @schemeidfont{map}
|
||||
identifier or the predefined function that is bound to
|
||||
@scheme[map], except that the symbol and the identifier happen
|
||||
to be made up of the same letters.
|
||||
|
@ -132,27 +132,27 @@ them.
|
|||
|
||||
@examples[
|
||||
map
|
||||
(eval:alts (#, @scheme[quote] #, @schemeidfont{map}) 'map)
|
||||
(eval:alts (symbol? (#, @scheme[quote] #, @schemeidfont{map})) (symbol? 'map))
|
||||
(eval:alts (@#,scheme[quote] @#,schemeidfont{map}) 'map)
|
||||
(eval:alts (symbol? (@#,scheme[quote] @#,schemeidfont{map})) (symbol? 'map))
|
||||
(symbol? map)
|
||||
(procedure? map)
|
||||
(string->symbol "map")
|
||||
(eval:alts (symbol->string (#, @scheme[quote] #, @schemeidfont{map})) (symbol->string 'map))
|
||||
(eval:alts (symbol->string (@#,scheme[quote] @#,schemeidfont{map})) (symbol->string 'map))
|
||||
]
|
||||
|
||||
When @scheme[quote] is used on a parenthesized sequence of
|
||||
identifiers, it creates a list of symbols:
|
||||
|
||||
@interaction[
|
||||
(eval:alts (#, @scheme[quote] (#, @schemeidfont{road} #, @schemeidfont{map})) '(road map))
|
||||
(eval:alts (car (#, @scheme[quote] (#, @schemeidfont{road} #, @schemeidfont{map}))) (car '(road map)))
|
||||
(eval:alts (symbol? (car (#, @scheme[quote] (#, @schemeidfont{road} #, @schemeidfont{map})))) (symbol? (car '(road map))))
|
||||
(eval:alts (@#,scheme[quote] (@#,schemeidfont{road} @#,schemeidfont{map})) '(road map))
|
||||
(eval:alts (car (@#,scheme[quote] (@#,schemeidfont{road} @#,schemeidfont{map}))) (car '(road map)))
|
||||
(eval:alts (symbol? (car (@#,scheme[quote] (@#,schemeidfont{road} @#,schemeidfont{map})))) (symbol? (car '(road map))))
|
||||
]
|
||||
|
||||
@;------------------------------------------------------------------------
|
||||
@section{Abbreviating @scheme[quote] with @schemevalfont{'}}
|
||||
|
||||
If @scheme[(#, @scheme[quote] (1 2 3))] still seems like too much
|
||||
If @scheme[(@#,scheme[quote] (1 2 3))] still seems like too much
|
||||
typing, you can abbreviate by just putting @litchar{'} in front of
|
||||
@scheme[(1 2 3)]:
|
||||
|
||||
|
@ -175,7 +175,7 @@ way. You can see this if you put a @litchar{'} in front of a form that has a
|
|||
@litchar{'}:
|
||||
|
||||
@interaction[
|
||||
(eval:alts (car '(#, @schemevalfont{quote} #, @schemevalfont{road})) 'quote)
|
||||
(eval:alts (car '(@#,schemevalfont{quote} @#,schemevalfont{road})) 'quote)
|
||||
(car ''road)
|
||||
]
|
||||
|
||||
|
@ -186,7 +186,7 @@ Beware, however, that the @tech{REPL}'s printer recognizes the symbol
|
|||
@interaction[
|
||||
'road
|
||||
''road
|
||||
(eval:alts '(#, @schemevalfont{quote} #, @schemevalfont{road}) ''road)
|
||||
(eval:alts '(@#,schemevalfont{quote} @#,schemevalfont{road}) ''road)
|
||||
]
|
||||
|
||||
@; FIXME:
|
||||
|
@ -223,10 +223,10 @@ One consequence of the read layer for expressions is that you can use
|
|||
the dot notation in expressions that are not quoted forms:
|
||||
|
||||
@interaction[
|
||||
(eval:alts (+ 1 . #, @scheme[(2)]) (+ 1 2))
|
||||
(eval:alts (+ 1 . @#,scheme[(2)]) (+ 1 2))
|
||||
]
|
||||
|
||||
This works because @scheme[(+ 1 . #, @scheme[(2)])] is just another
|
||||
This works because @scheme[(+ 1 . @#,scheme[(2)])] is just another
|
||||
way of writing @scheme[(+ 1 2)]. It is practically never a good idea
|
||||
to write application expressions using this dot notation; it's just a
|
||||
consequence of the way Scheme's syntax is defined.
|
||||
|
|
|
@ -322,7 +322,7 @@ scheme
|
|||
|
||||
(define (store-color) the-color)
|
||||
|
||||
(code:comment #, @t{the rest is the same as before})
|
||||
(code:comment @#,t{the rest is the same as before})
|
||||
|
||||
(define (maybe-repaint t)
|
||||
(if (eq? (toy-color t) (store-color))
|
||||
|
|
|
@ -19,8 +19,8 @@ represent symbols and lists.
|
|||
@refdetails/gory["parse-vector"]{the syntax of vectors}
|
||||
|
||||
@examples[
|
||||
(eval:alts #, @schemevalfont{#("a" "b" "c")} #("a" "b" "c"))
|
||||
(eval:alts #, @schemevalfont{#(name (that tune))} #(name (that tune)))
|
||||
(eval:alts @#,schemevalfont{#("a" "b" "c")} #("a" "b" "c"))
|
||||
(eval:alts @#,schemevalfont{#(name (that tune))} #(name (that tune)))
|
||||
(vector-ref #("a" "b" "c") 1)
|
||||
(vector-ref #(name (that tune)) 1)
|
||||
]
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
(let id ([id expr] ...) expr)
|
||||
(let* ([id expr] ...) expr)
|
||||
(recur id ([id expr] ...) expr)
|
||||
(code:line (expr expr ...) (code:comment #, @seclink["advanced-call"]{function call}))
|
||||
(code:line (expr expr ...) (code:comment @#,seclink["advanced-call"]{function call}))
|
||||
(cond [expr expr] ... [expr expr])
|
||||
(cond [expr expr] ... [else expr])
|
||||
(case expr [(choice choice ...) expr] ...
|
||||
|
@ -81,17 +81,17 @@
|
|||
(or expr expr expr ...)
|
||||
(time expr)
|
||||
empty
|
||||
(code:line id (code:comment #, @seclink["intermediate-id"]{identifier}))
|
||||
(code:line prim-op (code:comment #, @seclink["intermediate-lambda-prim-op"]{primitive operation}))
|
||||
(code:line id (code:comment @#,seclink["intermediate-id"]{identifier}))
|
||||
(code:line prim-op (code:comment @#,seclink["intermediate-lambda-prim-op"]{primitive operation}))
|
||||
'id
|
||||
(code:line #, @elem{@schemevalfont{'}@scheme[quoted]} (code:comment #, @seclink["beginner-abbr-quote"]{quoted value}))
|
||||
(code:line #, @elem{@schemevalfont{`}@scheme[quasiquoted]} (code:comment #, @seclink["beginner-abbr-quasiquote"]{quasiquote}))
|
||||
(code:line @#,elem{@schemevalfont{'}@scheme[quoted]} (code:comment @#,seclink["beginner-abbr-quote"]{quoted value}))
|
||||
(code:line @#,elem{@schemevalfont{`}@scheme[quasiquoted]} (code:comment @#,seclink["beginner-abbr-quasiquote"]{quasiquote}))
|
||||
number
|
||||
true
|
||||
false
|
||||
string
|
||||
character]
|
||||
[choice (code:line id (code:comment #, @t{treated as a symbol}))
|
||||
[choice (code:line id (code:comment @#,t{treated as a symbol}))
|
||||
number]
|
||||
]
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
(define id expr)
|
||||
(define id (lambda (id id ...) expr))
|
||||
(define-struct id (id ...))]
|
||||
[expr (code:line (id expr expr ...) (code:comment #, @seclink["beginner-call"]{function call}))
|
||||
(code:line (prim-op expr ...) (code:comment #, @seclink["beginner-prim-call"]{primitive operation call}))
|
||||
[expr (code:line (id expr expr ...) (code:comment @#,seclink["beginner-call"]{function call}))
|
||||
(code:line (prim-op expr ...) (code:comment @#,seclink["beginner-prim-call"]{primitive operation call}))
|
||||
(cond [expr expr] ... [expr expr])
|
||||
(cond [expr expr] ... [else expr])
|
||||
(if expr expr expr)
|
||||
|
@ -44,8 +44,8 @@
|
|||
(or expr expr expr ...)
|
||||
empty
|
||||
id
|
||||
(code:line #, @elem{@schemevalfont{'}@scheme[quoted]} (code:comment #, @seclink["beginner-abbr-quote"]{quoted value}))
|
||||
(code:line #, @elem{@schemevalfont{`}@scheme[quasiquoted]} (code:comment #, @seclink["beginner-abbr-quasiquote"]{quasiquote}))
|
||||
(code:line @#,elem{@schemevalfont{'}@scheme[quoted]} (code:comment @#,seclink["beginner-abbr-quote"]{quoted value}))
|
||||
(code:line @#,elem{@schemevalfont{`}@scheme[quasiquoted]} (code:comment @#,seclink["beginner-abbr-quasiquote"]{quasiquote}))
|
||||
number
|
||||
true
|
||||
false
|
||||
|
@ -70,7 +70,7 @@ Creates symbols and abbreviates nested lists.
|
|||
|
||||
Normally, this form is written with a @litchar{'}, like
|
||||
@scheme['(apple banana)], but it can also be written with @scheme[quote], like
|
||||
@scheme[(#, @scheme[quote] (apple banana))].}
|
||||
@scheme[(@#,scheme[quote] (apple banana))].}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
|
@ -87,7 +87,7 @@ to expression ``unquotes.''
|
|||
Normally, this form is written with a backquote, @litchar{`}, like
|
||||
@scheme[`(apple ,(+ 1 2))], but it can also be written with
|
||||
@scheme[quasiquote], like
|
||||
@scheme[(#, @scheme[quasiquote] (apple ,(+ 1 2)))].}
|
||||
@scheme[(@#,scheme[quasiquote] (apple ,(+ 1 2)))].}
|
||||
|
||||
|
||||
@deftogether[(
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
(define id expr)
|
||||
(define id (lambda (id id ...) expr))
|
||||
(define-struct id (id ...))]
|
||||
[expr (code:line (id expr expr ...) (code:comment #, @seclink["beginner-call"]{function call}))
|
||||
(code:line (prim-op expr ...) (code:comment #, @seclink["beginner-prim-call"]{primitive operation call}))
|
||||
[expr (code:line (id expr expr ...) (code:comment @#,seclink["beginner-call"]{function call}))
|
||||
(code:line (prim-op expr ...) (code:comment @#,seclink["beginner-prim-call"]{primitive operation call}))
|
||||
(cond [expr expr] ... [expr expr])
|
||||
(cond [expr expr] ... [else expr])
|
||||
(if expr expr expr)
|
||||
|
@ -31,8 +31,8 @@
|
|||
(or expr expr expr ...)
|
||||
empty
|
||||
id
|
||||
(code:line id (code:comment #, @seclink["beginner-id"]{identifier}))
|
||||
(code:line #, @elem{@schemevalfont{'}@scheme[id]} (code:comment #, @seclink["beginner-quote"]{symbol}))
|
||||
(code:line id (code:comment @#,seclink["beginner-id"]{identifier}))
|
||||
(code:line @#,elem{@schemevalfont{'}@scheme[id]} (code:comment @#,seclink["beginner-quote"]{symbol}))
|
||||
number
|
||||
true
|
||||
false
|
||||
|
@ -276,7 +276,7 @@ A quoted @scheme[id] is a symbol. A symbol is a constant, like
|
|||
|
||||
Normally, a symbol is written with a @litchar{'}, like
|
||||
@scheme['apple], but it can also be written with @scheme[quote], like
|
||||
@scheme[(#, @scheme[quote] apple)].
|
||||
@scheme[(@#,scheme[quote] apple)].
|
||||
|
||||
The @scheme[id] for a symbol is a sequence of characters not including
|
||||
a space or one of the following:}
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
(letrec ([id expr] ...) expr)
|
||||
(let ([id expr] ...) expr)
|
||||
(let* ([id expr] ...) expr)
|
||||
(code:line (expr expr expr ...) (code:comment #, @seclink["intermediate-lambda-call"]{function call}))
|
||||
(code:line (expr expr expr ...) (code:comment @#,seclink["intermediate-lambda-call"]{function call}))
|
||||
(cond [expr expr] ... [expr expr])
|
||||
(cond [expr expr] ... [else expr])
|
||||
(if expr expr expr)
|
||||
|
@ -60,11 +60,11 @@
|
|||
(or expr expr expr ...)
|
||||
(time expr)
|
||||
empty
|
||||
(code:line id (code:comment #, @seclink["intermediate-id"]{identifier}))
|
||||
(code:line prim-op (code:comment #, @seclink["intermediate-lambda-prim-op"]{primitive operation}))
|
||||
(code:line id (code:comment @#,seclink["intermediate-id"]{identifier}))
|
||||
(code:line prim-op (code:comment @#,seclink["intermediate-lambda-prim-op"]{primitive operation}))
|
||||
'id
|
||||
(code:line #, @elem{@schemevalfont{'}@scheme[quoted]} (code:comment #, @seclink["beginner-abbr-quote"]{quoted value}))
|
||||
(code:line #, @elem{@schemevalfont{`}@scheme[quasiquoted]} (code:comment #, @seclink["beginner-abbr-quasiquote"]{quasiquote}))
|
||||
(code:line @#,elem{@schemevalfont{'}@scheme[quoted]} (code:comment @#,seclink["beginner-abbr-quote"]{quoted value}))
|
||||
(code:line @#,elem{@schemevalfont{`}@scheme[quasiquoted]} (code:comment @#,seclink["beginner-abbr-quasiquote"]{quasiquote}))
|
||||
number
|
||||
true
|
||||
false
|
||||
|
|
|
@ -38,8 +38,8 @@
|
|||
(letrec ([id expr-for-let] ...) expr)
|
||||
(let ([id expr-for-let] ...) expr)
|
||||
(let* ([id expr-for-let] ...) expr)
|
||||
(code:line (id expr expr ...) (code:comment #, @seclink["intermediate-call"]{function call}))
|
||||
(code:line (prim-op expr ...) (code:comment #, @seclink["beginner-prim-call"]{primitive operation call}))
|
||||
(code:line (id expr expr ...) (code:comment @#,seclink["intermediate-call"]{function call}))
|
||||
(code:line (prim-op expr ...) (code:comment @#,seclink["beginner-prim-call"]{primitive operation call}))
|
||||
(cond [expr expr] ... [expr expr])
|
||||
(cond [expr expr] ... [else expr])
|
||||
(if expr expr expr)
|
||||
|
@ -47,11 +47,11 @@
|
|||
(or expr expr expr ...)
|
||||
(time expr)
|
||||
empty
|
||||
(code:line id (code:comment #, @seclink["intermediate-id"]{identifier}))
|
||||
(code:line prim-op (code:comment #, @seclink["intermediate-prim-op"]{primitive operation}))
|
||||
(code:line id (code:comment @#,seclink["intermediate-id"]{identifier}))
|
||||
(code:line prim-op (code:comment @#,seclink["intermediate-prim-op"]{primitive operation}))
|
||||
'id
|
||||
(code:line #, @elem{@schemevalfont{'}@scheme[quoted]} (code:comment #, @seclink["beginner-abbr-quote"]{quoted value}))
|
||||
(code:line #, @elem{@schemevalfont{`}@scheme[quasiquoted]} (code:comment #, @seclink["beginner-abbr-quasiquote"]{quasiquote}))
|
||||
(code:line @#,elem{@schemevalfont{'}@scheme[quoted]} (code:comment @#,seclink["beginner-abbr-quote"]{quoted value}))
|
||||
(code:line @#,elem{@schemevalfont{`}@scheme[quasiquoted]} (code:comment @#,seclink["beginner-abbr-quasiquote"]{quasiquote}))
|
||||
number
|
||||
true
|
||||
false
|
||||
|
|
|
@ -17,15 +17,15 @@
|
|||
(schemegrammar*
|
||||
#:literals lits
|
||||
form ...
|
||||
[test-case #, @scheme[(check-expect expr expr)]
|
||||
#, @scheme[(check-within expr expr expr)]
|
||||
#, @scheme[(check-error expr expr)]]
|
||||
[test-case @#,scheme[(check-expect expr expr)]
|
||||
@#,scheme[(check-within expr expr expr)]
|
||||
@#,scheme[(check-error expr expr)]]
|
||||
(...
|
||||
[library-require #, @scheme[(require string)]
|
||||
#, @scheme[(require (lib string string ...))]
|
||||
#, @scheme[(require (planet string package))]])
|
||||
[library-require @#,scheme[(require string)]
|
||||
@#,scheme[(require (lib string string ...))]
|
||||
@#,scheme[(require (planet string package))]])
|
||||
(...
|
||||
[package #, @scheme[(string string number number)]])))
|
||||
[package @#,scheme[(string string number number)]])))
|
||||
|
||||
(define-syntax-rule (schemegrammar*+qq
|
||||
#:literals lits
|
||||
|
@ -40,21 +40,21 @@
|
|||
number
|
||||
string
|
||||
character
|
||||
#, @scheme[(quoted ...)]
|
||||
#, @elem{@schemevalfont{'}@scheme[quoted]}
|
||||
#, @elem{@schemevalfont{`}@scheme[quoted]}
|
||||
#, @elem{@schemefont{,}@scheme[quoted]}
|
||||
#, @elem{@schemefont[",@"]@scheme[quoted]}])
|
||||
@#,scheme[(quoted ...)]
|
||||
@#,elem{@schemevalfont{'}@scheme[quoted]}
|
||||
@#,elem{@schemevalfont{`}@scheme[quoted]}
|
||||
@#,elem{@schemefont{,}@scheme[quoted]}
|
||||
@#,elem{@schemefont[",@"]@scheme[quoted]}])
|
||||
(...
|
||||
[quasiquoted id
|
||||
number
|
||||
string
|
||||
character
|
||||
#, @scheme[(quasiquoted ...)]
|
||||
#, @elem{@schemevalfont{'}@scheme[quasiquoted]}
|
||||
#, @elem{@schemevalfont{`}@scheme[quasiquoted]}
|
||||
#, @elem{@schemefont{,}@scheme[expr]}
|
||||
#, @elem{@schemefont[",@"]@scheme[expr]}])))
|
||||
@#,scheme[(quasiquoted ...)]
|
||||
@#,elem{@schemevalfont{'}@scheme[quasiquoted]}
|
||||
@#,elem{@schemevalfont{`}@scheme[quasiquoted]}
|
||||
@#,elem{@schemefont{,}@scheme[expr]}
|
||||
@#,elem{@schemefont[",@"]@scheme[expr]}])))
|
||||
|
||||
(define prim-nonterms
|
||||
(make-splice
|
||||
|
|
|
@ -173,9 +173,9 @@ header, and then write a ``Hello, world!'' web page as the result:
|
|||
|
||||
@schemeblock[
|
||||
(define (handle in out)
|
||||
(code:comment #, @t{Discard the request header (up to blank line):})
|
||||
(code:comment @#,t{Discard the request header (up to blank line):})
|
||||
(regexp-match #rx"(\r\n|^)\r\n" in)
|
||||
(code:comment #, @t{Send reply:})
|
||||
(code:comment @#,t{Send reply:})
|
||||
(display "HTTP/1.0 200 Okay\r\n" out)
|
||||
(display "Server: k\r\nContent-Type: text/html\r\n\r\n" out)
|
||||
(display "<html><body>Hello, world!</body></html>" out))
|
||||
|
@ -315,7 +315,7 @@ watcher-thread strategy works well:
|
|||
(handle in out)
|
||||
(close-input-port in)
|
||||
(close-output-port out))))
|
||||
(code:comment #, @t{Watcher thread:})
|
||||
(code:comment @#,t{Watcher thread:})
|
||||
(thread (lambda ()
|
||||
(sleep 10)
|
||||
(kill-thread t))))
|
||||
|
@ -346,7 +346,7 @@ custodian:
|
|||
(handle in out)
|
||||
(close-input-port in)
|
||||
(close-output-port out))))
|
||||
(code:comment #, @t{Watcher thread:})
|
||||
(code:comment @#,t{Watcher thread:})
|
||||
(thread (lambda ()
|
||||
(sleep 10)
|
||||
(custodian-shutdown-all cust))))
|
||||
|
@ -442,15 +442,15 @@ takes a requested URL and produces a result value suitable to use with
|
|||
@schemeblock[
|
||||
(define (handle in out)
|
||||
(define req
|
||||
(code:comment #, @t{Match the first line to extract the request:})
|
||||
(code:comment @#,t{Match the first line to extract the request:})
|
||||
(regexp-match #rx"^GET (.+) HTTP/[0-9]+\\.[0-9]+"
|
||||
(read-line in)))
|
||||
(when req
|
||||
(code:comment #, @t{Discard the rest of the header (up to blank line):})
|
||||
(code:comment @#,t{Discard the rest of the header (up to blank line):})
|
||||
(regexp-match #rx"(\r\n|^)\r\n" in)
|
||||
(code:comment #, @t{Dispatch:})
|
||||
(code:comment @#,t{Dispatch:})
|
||||
(let ([xexpr (dispatch (list-ref req 1))])
|
||||
(code:comment #, @t{Send reply:})
|
||||
(code:comment @#,t{Send reply:})
|
||||
(display "HTTP/1.0 200 Okay\r\n" out)
|
||||
(display "Server: k\r\nContent-Type: text/html\r\n\r\n" out)
|
||||
(display (xexpr->string xexpr) out))))
|
||||
|
@ -474,16 +474,16 @@ path element, like @scheme["foo"], to a handler function:
|
|||
|
||||
@schemeblock[
|
||||
(define (dispatch str-path)
|
||||
(code:comment #, @t{Parse the request as a URL:})
|
||||
(code:comment @#,t{Parse the request as a URL:})
|
||||
(define url (string->url str-path))
|
||||
(code:comment #, @t{Extract the path part:})
|
||||
(code:comment @#,t{Extract the path part:})
|
||||
(define path (map path/param-path (url-path url)))
|
||||
(code:comment #, @t{Find a handler based on the path's first element:})
|
||||
(code:comment @#,t{Find a handler based on the path's first element:})
|
||||
(define h (hash-ref dispatch-table (car path) #f))
|
||||
(if h
|
||||
(code:comment #, @t{Call a handler:})
|
||||
(code:comment @#,t{Call a handler:})
|
||||
(h (url-query url))
|
||||
(code:comment #, @t{No handler found:})
|
||||
(code:comment @#,t{No handler found:})
|
||||
`(html (head (title "Error"))
|
||||
(body
|
||||
(font ((color "red"))
|
||||
|
@ -684,14 +684,14 @@ Thus, @scheme[get-number] is implemented as follows:
|
|||
@schemeblock[
|
||||
(define (get-number label)
|
||||
(define query
|
||||
(code:comment #, @t{Generate a URL for the current computation:})
|
||||
(code:comment @#,t{Generate a URL for the current computation:})
|
||||
(send/suspend
|
||||
(code:comment #, @t{Receive the computation-as-URL here:})
|
||||
(code:comment @#,t{Receive the computation-as-URL here:})
|
||||
(lambda (k-url)
|
||||
(code:comment #, @t{Generate the query-page result for this connection.})
|
||||
(code:comment #, @t{Send the query result to the saved-computation URL:})
|
||||
(code:comment @#,t{Generate the query-page result for this connection.})
|
||||
(code:comment @#,t{Send the query result to the saved-computation URL:})
|
||||
(build-request-page label k-url ""))))
|
||||
(code:comment #, @t{We arrive here later, in a new connection})
|
||||
(code:comment @#,t{We arrive here later, in a new connection})
|
||||
(string->number (cdr (assq 'number query))))
|
||||
]
|
||||
|
||||
|
|
|
@ -151,8 +151,8 @@ arguments before the matching close parenthesis:
|
|||
|
||||
@mr-schemeblock+eval[
|
||||
(define (square n)
|
||||
(code:comment #, @t{A semi-colon starts a line comment.})
|
||||
(code:comment #, @t{The expression below is the function body.})
|
||||
(code:comment @#,t{A semi-colon starts a line comment.})
|
||||
(code:comment @#,t{The expression below is the function body.})
|
||||
(filled-rectangle n n))
|
||||
]
|
||||
|
||||
|
|
|
@ -192,16 +192,16 @@ Example:
|
|||
#:once-any
|
||||
[("-o" "--optimize-1") "Compile with optimization level 1"
|
||||
(optimize-level 1)]
|
||||
["--optimize-2" ((code:comment #, @t{show help on separate lines})
|
||||
["--optimize-2" ((code:comment @#,t{show help on separate lines})
|
||||
"Compile with optimization level 2,"
|
||||
"which includes all of level 1")
|
||||
(optimize-level 2)]
|
||||
#:multi
|
||||
[("-l" "--link-flags") lf (code:comment #, @t{flag takes one argument})
|
||||
[("-l" "--link-flags") lf (code:comment @#,t{flag takes one argument})
|
||||
"Add a flag <lf> for the linker"
|
||||
(link-flags (cons lf (link-flags)))]
|
||||
#:args (filename) (code:comment #, @t{expect one command-line argument: <filename>})
|
||||
(code:comment #, @t{return the argument as a filename to compile})
|
||||
#:args (filename) (code:comment @#,t{expect one command-line argument: <filename>})
|
||||
(code:comment @#,t{return the argument as a filename to compile})
|
||||
filename))
|
||||
]}
|
||||
|
||||
|
|
|
@ -186,11 +186,11 @@ default error display handler (see
|
|||
(extract-current-continuation-marks 'key2))))
|
||||
|
||||
(with-continuation-mark 'key 'mark1
|
||||
(with-continuation-mark 'key 'mark2 (code:comment #, @t{replaces previous mark})
|
||||
(with-continuation-mark 'key 'mark2 (code:comment @#,t{replaces previous mark})
|
||||
(extract-current-continuation-marks 'key)))
|
||||
|
||||
(with-continuation-mark 'key 'mark1
|
||||
(list (code:comment #, @t{continuation extended to evaluate the argument})
|
||||
(list (code:comment @#,t{continuation extended to evaluate the argument})
|
||||
(with-continuation-mark 'key 'mark2
|
||||
(extract-current-continuation-marks 'key))))
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ The essential reduction rules are:
|
|||
@schemeblock[
|
||||
(% _val proc) => _val
|
||||
(% _E[(fcontrol _val)] _proc) => (_proc _val (lambda (_x) _E[_x]))
|
||||
(code:comment #, @t{where @scheme[_E] has no @scheme[%]})
|
||||
(code:comment @#,t{where @scheme[_E] has no @scheme[%]})
|
||||
]
|
||||
|
||||
When @scheme[handler-expr] is omitted, @scheme[%] is the same as
|
||||
|
@ -66,7 +66,7 @@ The essential reduction rules are:
|
|||
(prompt _val) => _val
|
||||
(prompt _E[(control _k _expr)]) => (prompt ((lambda (_k) _expr)
|
||||
(lambda (_v) _E[_v])))
|
||||
(code:comment #, @t{where @scheme[_E] has no @scheme[prompt]})
|
||||
(code:comment @#,t{where @scheme[_E] has no @scheme[prompt]})
|
||||
]}
|
||||
|
||||
@; ----------------------------------------------------------------------
|
||||
|
@ -84,7 +84,7 @@ tags:
|
|||
(prompt-at _tag _E[(control-at _tag _k _expr)]) => (prompt-at _tag
|
||||
((lambda (_k) _expr)
|
||||
(lambda (_v) _E[_v])))
|
||||
(code:comment #, @t{where @scheme[_E] has no @scheme[prompt-at] for @scheme[_tag]})
|
||||
(code:comment @#,t{where @scheme[_E] has no @scheme[prompt-at] for @scheme[_tag]})
|
||||
]}
|
||||
|
||||
@; ----------------------------------------------------------------------
|
||||
|
@ -102,7 +102,7 @@ The essential reduction rules are:
|
|||
(reset _val) => _val
|
||||
(reset _E[(shift _k _expr)]) => (reset ((lambda (_k) _expr)
|
||||
(lambda (_v) (reset _E[_v]))))
|
||||
(code:comment #, @t{where @scheme[_E] has no @scheme[reset]})
|
||||
(code:comment @#,t{where @scheme[_E] has no @scheme[reset]})
|
||||
]
|
||||
|
||||
The @scheme[reset] and @scheme[prompt] forms are interchangeable.}
|
||||
|
@ -182,7 +182,7 @@ The essential reduction rules are:
|
|||
(spawn _proc) => (prompt _tag (_proc (lambda (_x) (abort _tag _x))))
|
||||
(prompt-at _tag _E[(abort _tag _proc)])
|
||||
=> (_proc (lambda (_x) (prompt-at _tag _E[_x])))
|
||||
(code:comment #, @t{where @scheme[_E] has no @scheme[prompt-at] for @scheme[_tag]})
|
||||
(code:comment @#,t{where @scheme[_E] has no @scheme[prompt-at] for @scheme[_tag]})
|
||||
]}
|
||||
|
||||
@; ----------------------------------------------------------------------
|
||||
|
@ -202,10 +202,10 @@ The essential reduction rules are:
|
|||
(lambda (_proc)
|
||||
(control0-at _tag _k (_proc _k)))))
|
||||
(prompt-at _tag _E[(abort _tag _thunk)]) => (_thunk)
|
||||
(code:comment #, @t{where @scheme[_E] has no @scheme[prompt-at] for @scheme[_tag]})
|
||||
(code:comment @#,t{where @scheme[_E] has no @scheme[prompt-at] for @scheme[_tag]})
|
||||
(prompt-at _tag _E[(control0-at _tag _k _expr)]) => ((lambda (_k) _expr)
|
||||
(lambda (_x) _E[_x]))
|
||||
(code:comment #, @t{where @scheme[_E] has no @scheme[prompt-at] for @scheme[_tag]})
|
||||
(code:comment @#,t{where @scheme[_E] has no @scheme[prompt-at] for @scheme[_tag]})
|
||||
]}
|
||||
|
||||
@; ----------------------------------------------------------------------
|
||||
|
|
|
@ -43,7 +43,7 @@ simplifies
|
|||
Scheme evaluation simplifies
|
||||
|
||||
@schemeblock[
|
||||
(+ 1 1) #, @reduces 2
|
||||
(+ 1 1) @#,reduces 2
|
||||
]
|
||||
|
||||
The arrow @reduces above replaces the more traditional @tt{=} to
|
||||
|
@ -66,7 +66,7 @@ into two parts: a @deftech{redex}, which is the part that changed in a
|
|||
single-step simplification (highlighted), and the
|
||||
@deftech{continuation}, which is the surrounding expression
|
||||
context. In @scheme[(- 4 (+ 1 1))], the redex is @scheme[(+ 1 1)], and
|
||||
the continuation is @scheme[(- 4 #, @hole)], where @hole takes the
|
||||
the continuation is @scheme[(- 4 @#,hole)], where @hole takes the
|
||||
place of the redex. That is, the continuation says how to ``continue''
|
||||
after the @tech{redex} is reduced to a @tech{value}.
|
||||
|
||||
|
@ -97,18 +97,18 @@ substituting @scheme[_expr] in place of @hole in the @tech{continuation}
|
|||
@scheme[_C]:
|
||||
|
||||
@schemeblock[
|
||||
#, @sub[_C (- 4 (+ 1 1))] #, @reduces #, @sub[_C (- 4 2)]
|
||||
@#,sub[_C (- 4 (+ 1 1))] @#,reduces @#,sub[_C (- 4 2)]
|
||||
]
|
||||
|
||||
In this case, the @tech{continuation} for reducing @scheme[(+ 1 1)] is
|
||||
@sub[_C (+ 4 #, @hole)], not just @scheme[_C].
|
||||
@sub[_C (+ 4 @#,hole)], not just @scheme[_C].
|
||||
|
||||
In contrast, @scheme[(+ 1 1)] is in @tech{tail position} with respect
|
||||
to @scheme[(if (zero? 0) (+ 1 1) 3)], because, for any continuation
|
||||
@scheme[_C],
|
||||
|
||||
@schemeblock[
|
||||
#, @sub[_C (if (zero? 0) (+ 1 1) 3)] #, @reduces #, @sub[_C (if #t (+ 1 1) 3)] #, @reduces #, @sub[_C (+ 1 1)]
|
||||
@#,sub[_C (if (zero? 0) (+ 1 1) 3)] @#,reduces @#,sub[_C (if #t (+ 1 1) 3)] @#,reduces @#,sub[_C (+ 1 1)]
|
||||
]
|
||||
|
||||
The steps in this reduction sequence are driven by the definition of
|
||||
|
@ -131,11 +131,11 @@ same way that a procedure can accept multiple arguments.
|
|||
|
||||
Most @tech{continuations} expect a particular number of result
|
||||
@tech{values}. Indeed, most @tech{continuations}, such as @scheme[(+
|
||||
#, @hole 1)] expect a single @tech{value}. The @tech{continuation}
|
||||
@scheme[(let-values ([(x y) #, @hole]) _expr)] expects two result
|
||||
@#,hole 1)] expect a single @tech{value}. The @tech{continuation}
|
||||
@scheme[(let-values ([(x y) @#,hole]) _expr)] expects two result
|
||||
@tech{values}; the first result replaces @scheme[x] in the body
|
||||
@scheme[_expr], and the second replaces @scheme[y] in
|
||||
@scheme[_expr]. The @tech{continuation} @scheme[(begin #, @hole (+ 1
|
||||
@scheme[_expr]. The @tech{continuation} @scheme[(begin @#,hole (+ 1
|
||||
2))] accepts any number of result @tech{values}, because it ignores
|
||||
the result(s).
|
||||
|
||||
|
|
|
@ -482,26 +482,26 @@ to @scheme[(find-collects-dir)], and it is reconstructed using
|
|||
Examples:
|
||||
|
||||
@schemeblock[
|
||||
(code:comment #, @t{Access a file @filepath{data.txt} at run-time that is originally})
|
||||
(code:comment #, @t{located in the same directory as the module source file:})
|
||||
(code:comment @#,t{Access a file @filepath{data.txt} at run-time that is originally})
|
||||
(code:comment @#,t{located in the same directory as the module source file:})
|
||||
(define-runtime-path data-file "data.txt")
|
||||
(define (read-data)
|
||||
(with-input-from-file data-file
|
||||
(lambda ()
|
||||
(read-bytes (file-size data-file)))))
|
||||
|
||||
(code:comment #, @t{Load a platform-specific shared object (using @scheme[ffi-lib])})
|
||||
(code:comment #, @t{that is located in a platform-specific sub-directory of the})
|
||||
(code:comment #, @t{module's source directory:})
|
||||
(code:comment @#,t{Load a platform-specific shared object (using @scheme[ffi-lib])})
|
||||
(code:comment @#,t{that is located in a platform-specific sub-directory of the})
|
||||
(code:comment @#,t{module's source directory:})
|
||||
(define-runtime-path libfit-path
|
||||
(build-path "compiled" "native" (system-library-subpath #f)
|
||||
(path-replace-suffix "libfit"
|
||||
(system-type 'so-suffix))))
|
||||
(define libfit (ffi-lib libfit-path))
|
||||
|
||||
(code:comment #, @t{Load a platform-specific shared object that might be installed})
|
||||
(code:comment #, @t{as part of the operating system, or might be installed})
|
||||
(code:comment #, @t{specifically for PLT Scheme:})
|
||||
(code:comment @#,t{Load a platform-specific shared object that might be installed})
|
||||
(code:comment @#,t{as part of the operating system, or might be installed})
|
||||
(code:comment @#,t{specifically for PLT Scheme:})
|
||||
(define-runtime-path libssl-so
|
||||
(case (system-type)
|
||||
[(windows) '(so "ssleay32")]
|
||||
|
|
|
@ -64,8 +64,8 @@ introduces a binding without actually executing the
|
|||
documentation, but cannot or do not want to run the providing module.
|
||||
|
||||
@schemeblock[
|
||||
(require scheme/gui) (code:comment #, @t{does not work in @exec{mzscheme}})
|
||||
(require (for-label scheme/gui)) (code:comment #, @t{ok in @exec{mzscheme}})
|
||||
(require scheme/gui) (code:comment @#,t{does not work in @exec{mzscheme}})
|
||||
(require (for-label scheme/gui)) (code:comment @#,t{ok in @exec{mzscheme}})
|
||||
(help frame%)
|
||||
]
|
||||
|
||||
|
@ -79,7 +79,7 @@ The @scheme[(help id #:from module-path)] variant is similar to
|
|||
@scheme[for-label] in a temporary namespace.)
|
||||
|
||||
@schemeblock[
|
||||
(help frame% #:from scheme/gui) (code:comment #, @t{equivalent to the above})
|
||||
(help frame% #:from scheme/gui) (code:comment @#,t{equivalent to the above})
|
||||
]
|
||||
|
||||
The @scheme[(help #:search datum ...)] form is similar to
|
||||
|
|
|
@ -137,15 +137,15 @@ string.
|
|||
For each @schemekeywordfont{log-}@scheme[_level],
|
||||
|
||||
@schemeblock[
|
||||
(#, @schemekeywordfont{log-}_level string-expr)
|
||||
(@#,schemekeywordfont{log-}_level string-expr)
|
||||
]
|
||||
|
||||
is equivalent to
|
||||
|
||||
@schemeblock[
|
||||
(let ([l (current-logger)])
|
||||
(when (log-level? l '#, @scheme[_level])
|
||||
(log-message l '#, @scheme[_level] string-expr
|
||||
(when (log-level? l '@#,scheme[_level])
|
||||
(log-message l '@#,scheme[_level] string-expr
|
||||
(current-continuation-marks))))
|
||||
]}
|
||||
|
||||
|
|
|
@ -248,16 +248,16 @@ Windows examples.
|
|||
|
||||
@schemeblock[
|
||||
(define p1 (build-path (current-directory) "src" "scheme"))
|
||||
(code:comment #, @t{Unix: @scheme[p1] is @scheme["/home/joeuser/src/scheme"]})
|
||||
(code:comment #, @t{Windows: @scheme[p1] is @scheme["C:\\Joe's Files\\src\\scheme"]})
|
||||
(code:comment @#,t{Unix: @scheme[p1] is @scheme["/home/joeuser/src/scheme"]})
|
||||
(code:comment @#,t{Windows: @scheme[p1] is @scheme["C:\\Joe's Files\\src\\scheme"]})
|
||||
(define p2 (build-path 'up 'up "docs" "Scheme"))
|
||||
(code:comment #, @t{Unix: @scheme[p2] is @scheme["../../docs/Scheme"]})
|
||||
(code:comment #, @t{Windows: @scheme[p2] is @scheme["..\\..\\docs\\Scheme"]})
|
||||
(code:comment @#,t{Unix: @scheme[p2] is @scheme["../../docs/Scheme"]})
|
||||
(code:comment @#,t{Windows: @scheme[p2] is @scheme["..\\..\\docs\\Scheme"]})
|
||||
(build-path p2 p1)
|
||||
(code:comment #, @t{Unix and Windows: raises @scheme[exn:fail:contract]; @scheme[p1] is absolute})
|
||||
(code:comment @#,t{Unix and Windows: raises @scheme[exn:fail:contract]; @scheme[p1] is absolute})
|
||||
(build-path p1 p2)
|
||||
(code:comment #, @t{Unix: is @scheme["/home/joeuser/src/scheme/../../docs/Scheme"]})
|
||||
(code:comment #, @t{Windows: is @scheme["C:\\Joe's Files\\src\\scheme\\..\\..\\docs\\Scheme"]})
|
||||
(code:comment @#,t{Unix: is @scheme["/home/joeuser/src/scheme/../../docs/Scheme"]})
|
||||
(code:comment @#,t{Windows: is @scheme["C:\\Joe's Files\\src\\scheme\\..\\..\\docs\\Scheme"]})
|
||||
]}
|
||||
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ top-level namespace:
|
|||
@interaction[
|
||||
#:eval box-eval
|
||||
(define base-module-eval
|
||||
(code:comment #, @t{a module cannot have free variables...})
|
||||
(code:comment @#,t{a module cannot have free variables...})
|
||||
(make-evaluator 'scheme/base '(define (f) later)))
|
||||
(define base-module-eval
|
||||
(make-evaluator 'scheme/base '(define (f) later)
|
||||
|
@ -145,7 +145,7 @@ top-level namespace:
|
|||
(base-module-eval '(f))
|
||||
|
||||
(define base-top-eval
|
||||
(code:comment #, @t{non-module code can have free variables:})
|
||||
(code:comment @#,t{non-module code can have free variables:})
|
||||
(make-evaluator '(begin) '(define (f) later)))
|
||||
(base-top-eval '(+ 1 2))
|
||||
(base-top-eval '(define later 5))
|
||||
|
@ -162,7 +162,7 @@ restriction is enforced).
|
|||
|
||||
@schemeblock[
|
||||
(define base-module-eval2
|
||||
(code:comment #, @t{equivalent to @scheme[base-module-eval]:})
|
||||
(code:comment @#,t{equivalent to @scheme[base-module-eval]:})
|
||||
(make-module-evaluator '(module m scheme/base
|
||||
(define (f) later)
|
||||
(define later 5))))
|
||||
|
@ -868,7 +868,7 @@ your own permissions, for example,
|
|||
(call-in-sandbox-context
|
||||
(lambda ()
|
||||
(parameterize ([current-security-guard guard])
|
||||
(code:comment #, @t{can access anything you want here})
|
||||
(code:comment @#,t{can access anything you want here})
|
||||
))))
|
||||
]}
|
||||
|
||||
|
|
|
@ -414,9 +414,9 @@ instance of @scheme[id] and copies its field values into @scheme[x].
|
|||
|
||||
(define-serializable-struct/versions point 1 (x y z)
|
||||
([0
|
||||
(code:comment #, @t{Constructor for simple v0 instances:})
|
||||
(code:comment @#,t{Constructor for simple v0 instances:})
|
||||
(lambda (x y) (make-point x y 0))
|
||||
(code:comment #, @t{Constructor for v0 instance in a cycle:})
|
||||
(code:comment @#,t{Constructor for v0 instance in a cycle:})
|
||||
(lambda ()
|
||||
(let ([p0 (make-point #f #f 0)])
|
||||
(values
|
||||
|
|
|
@ -50,7 +50,7 @@ production take precedence over later variants:
|
|||
(mcons patchable-expr patchable-expr)
|
||||
(vector patchable-expr ...)
|
||||
(box patchable-expr ...)
|
||||
(#, @|maker| patchable-expr ...)]
|
||||
(@#,|maker| patchable-expr ...)]
|
||||
[in-immutable-expr shell-id
|
||||
shell-expr
|
||||
early-expr]
|
||||
|
@ -105,12 +105,12 @@ data cycles (but only with cycles that can be created via mutation).
|
|||
(shared ([a (cons 1 b)]
|
||||
[b 7])
|
||||
a)
|
||||
(shared ([a a]) (code:comment #, @t{no indirection...})
|
||||
(shared ([a a]) (code:comment @#,t{no indirection...})
|
||||
a)
|
||||
(shared ([a (cons 1 b)] (code:comment #, @t{@scheme[b] is early...})
|
||||
(shared ([a (cons 1 b)] (code:comment @#,t{@scheme[b] is early...})
|
||||
[b a])
|
||||
a)
|
||||
(shared ([a (mcons 1 b)] (code:comment #, @t{@scheme[b] is patchable...})
|
||||
(shared ([a (mcons 1 b)] (code:comment @#,t{@scheme[b] is patchable...})
|
||||
[b a])
|
||||
a)
|
||||
(shared ([a (vector b b b)]
|
||||
|
@ -118,8 +118,8 @@ data cycles (but only with cycles that can be created via mutation).
|
|||
(set-box! b 5)
|
||||
a)
|
||||
(shared ([a (box b)]
|
||||
[b (vector (unbox a) (code:comment #, @t{@scheme[unbox] after @scheme[a] is patched})
|
||||
(unbox c))] (code:comment #, @t{@scheme[unbox] before @scheme[c] is patched})
|
||||
[b (vector (unbox a) (code:comment @#,t{@scheme[unbox] after @scheme[a] is patched})
|
||||
(unbox c))] (code:comment @#,t{@scheme[unbox] before @scheme[c] is patched})
|
||||
[c (box b)])
|
||||
b)
|
||||
]}
|
||||
|
|
|
@ -133,12 +133,12 @@ flags:
|
|||
@nonterm{file} : @scheme[require]s @nonterm{file}.}
|
||||
|
||||
@item{@FlagFirst{l} @nonterm{path} or @DFlagFirst{lib}
|
||||
@nonterm{path} : @scheme[require]s @scheme[(lib #,
|
||||
@nontermstr{path})].}
|
||||
@nonterm{path} : @scheme[require]s @scheme[(lib
|
||||
@#,nontermstr{path})].}
|
||||
|
||||
@item{@FlagFirst{p} @nonterm{file} @nonterm{u} @nonterm{path} :
|
||||
@scheme[require]s @scheme[(planet #, @nontermstr{file}
|
||||
#, @nontermstr{user} #, @nontermstr{pkg})].
|
||||
@scheme[require]s @scheme[(planet @#,nontermstr{file}
|
||||
@#,nontermstr{user} @#,nontermstr{pkg})].
|
||||
|
||||
@margin-note{Despite its name, @DFlag{script} is not usually
|
||||
used for Unix scripts. See @guidesecref["scripts"] for more
|
||||
|
@ -227,8 +227,8 @@ flags:
|
|||
@scheme[textual-read-eval-print-loop] instead of
|
||||
@scheme[graphical-read-eval-print-loop].}
|
||||
|
||||
@item{@FlagFirst{I} @nonterm{path} : Sets @scheme[(lib #,
|
||||
@nontermstr{path})] as the path to @scheme[require] to initialize
|
||||
@item{@FlagFirst{I} @nonterm{path} : Sets @scheme[(lib
|
||||
@#,nontermstr{path})] as the path to @scheme[require] to initialize
|
||||
the namespace, unless namespace initialization is disabled.}
|
||||
|
||||
@item{@FlagFirst{X} @nonterm{dir} or @DFlagFirst{collects}
|
||||
|
|
|
@ -187,7 +187,7 @@ must be a list or vector of five elements:
|
|||
|
||||
@schemeblock[
|
||||
(list source-name line column position span)
|
||||
#, @elem{or} (vector source-name line column position span)
|
||||
@#,elem{or} (vector source-name line column position span)
|
||||
]
|
||||
|
||||
where @scheme[source-name-v] is an arbitrary value for the source
|
||||
|
|
|
@ -42,9 +42,9 @@ expression is provided to the transformer.
|
|||
(let-syntax ([x (make-set!-transformer
|
||||
(lambda (stx)
|
||||
(syntax-case stx (set!)
|
||||
(code:comment #, @t{Redirect mutation of x to y})
|
||||
(code:comment @#,t{Redirect mutation of x to y})
|
||||
[(set! id v) (syntax (set! y v))]
|
||||
(code:comment #, @t{Normal use of @scheme[x] really gets @scheme[x]})
|
||||
(code:comment @#,t{Normal use of @scheme[x] really gets @scheme[x]})
|
||||
[id (identifier? (syntax id)) (syntax x)])))])
|
||||
(begin
|
||||
(set! x 3)
|
||||
|
|
|
@ -214,7 +214,7 @@ the binding (according to @scheme[free-identifier=?]) matters.}
|
|||
(letrec-values (((id ...) expr) ...)
|
||||
expr ...+)
|
||||
(set! id expr)
|
||||
(#, @scheme[quote] datum)
|
||||
(@#,scheme[quote] datum)
|
||||
(quote-syntax datum)
|
||||
(with-continuation-mark expr expr expr)
|
||||
(#%plain-app expr ...+)
|
||||
|
@ -777,15 +777,15 @@ and to start evaluating expanded/compiled code.
|
|||
|
||||
@examples[
|
||||
(code:line
|
||||
(define x 'orig) (code:comment #, @t{define in the original namespace}))
|
||||
(code:comment #, @t{The following @scheme[let] expression is compiled in the original})
|
||||
(code:comment #, @t{namespace, so direct references to @scheme[x] see @scheme['orig].})
|
||||
(define x 'orig) (code:comment @#,t{define in the original namespace}))
|
||||
(code:comment @#,t{The following @scheme[let] expression is compiled in the original})
|
||||
(code:comment @#,t{namespace, so direct references to @scheme[x] see @scheme['orig].})
|
||||
(code:line
|
||||
(let ([n (make-base-namespace)]) (code:comment #, @t{make new namespace})
|
||||
(let ([n (make-base-namespace)]) (code:comment @#,t{make new namespace})
|
||||
(parameterize ([current-namespace n])
|
||||
(eval '(define x 'new)) (code:comment #, @t{evals in the new namespace})
|
||||
(display x) (code:comment #, @t{displays @scheme['orig]})
|
||||
(display (eval 'x)))) (code:comment #, @t{displays @scheme['new]}))
|
||||
(eval '(define x 'new)) (code:comment @#,t{evals in the new namespace})
|
||||
(display x) (code:comment @#,t{displays @scheme['orig]})
|
||||
(display (eval 'x)))) (code:comment @#,t{displays @scheme['new]}))
|
||||
]
|
||||
|
||||
A @tech{namespace} is purely a top-level entity, not to be confused
|
||||
|
|
|
@ -41,7 +41,7 @@ a sequence of characters). These grammatical specifications are shown
|
|||
as in the following specification of a @schemekeywordfont{something}
|
||||
form:
|
||||
|
||||
@specsubform[(#, @schemekeywordfont{something} id thing-expr ...)
|
||||
@specsubform[(@#,schemekeywordfont{something} id thing-expr ...)
|
||||
#:contracts ([thing-expr number?])]
|
||||
|
||||
Within such specifications,
|
||||
|
@ -77,7 +77,7 @@ Within such specifications,
|
|||
]}
|
||||
|
||||
@item{Contracts indicate constraints on sub-expression results. For
|
||||
example, @scheme[_thing-expr #, @elem{:} number?] indicates that
|
||||
example, @scheme[_thing-expr @#,elem{:} number?] indicates that
|
||||
the expression @scheme[_thing-expr] must produce a number.}]
|
||||
|
||||
@;------------------------------------------------------------------------
|
||||
|
@ -611,13 +611,13 @@ corresponds to the default @tech{module name resolver}.
|
|||
symbolically.
|
||||
|
||||
@examples[
|
||||
(code:comment #, @t{@filepath{main.ss} in package @filepath{farm} by @filepath{mcdonald}:})
|
||||
(code:comment @#,t{@filepath{main.ss} in package @filepath{farm} by @filepath{mcdonald}:})
|
||||
(eval:alts (require (planet mcdonald/farm)) (void))
|
||||
(code:comment #, @t{@filepath{main.ss} in version >= 2.0 of package @filepath{farm} by @filepath{mcdonald}:})
|
||||
(code:comment @#,t{@filepath{main.ss} in version >= 2.0 of package @filepath{farm} by @filepath{mcdonald}:})
|
||||
(eval:alts (require (planet mcdonald/farm:2)) (void))
|
||||
(code:comment #, @t{@filepath{main.ss} in version >= 2.5 of package @filepath{farm} by @filepath{mcdonald}:})
|
||||
(code:comment @#,t{@filepath{main.ss} in version >= 2.5 of package @filepath{farm} by @filepath{mcdonald}:})
|
||||
(eval:alts (require (planet mcdonald/farm:2:5)) (void))
|
||||
(code:comment #, @t{@filepath{duck.ss} in version >= 2.5 of package @filepath{farm} by @filepath{mcdonald}:})
|
||||
(code:comment @#,t{@filepath{duck.ss} in version >= 2.5 of package @filepath{farm} by @filepath{mcdonald}:})
|
||||
(eval:alts (require (planet mcdonald/farm:2:5/duck)) (void))
|
||||
]}
|
||||
|
||||
|
@ -1135,10 +1135,10 @@ the reference evaluates to the value in the location associated with
|
|||
the binding.
|
||||
|
||||
When the expander encounters an @scheme[id] that is not bound by a
|
||||
module-level or local binding, it converts the expression to @scheme[(#,
|
||||
@schemeidfont{#%top} . id)] giving @schemeidfont{#%top} the lexical
|
||||
context of the @scheme[id]; typically, that context refers to
|
||||
@scheme[#%top]. See also @secref["expand-steps"].
|
||||
module-level or local binding, it converts the expression to
|
||||
@scheme[(@#,schemeidfont{#%top} . id)] giving @schemeidfont{#%top}
|
||||
the lexical context of the @scheme[id]; typically, that context refers
|
||||
to @scheme[#%top]. See also @secref["expand-steps"].
|
||||
|
||||
@examples[
|
||||
(define x 10)
|
||||
|
@ -1198,10 +1198,10 @@ Applies a procedure, when @scheme[proc-expr] is not an
|
|||
identifier that has a transformer binding (see
|
||||
@secref["expansion"]).
|
||||
|
||||
More precisely, the expander converts this form to @scheme[(#,
|
||||
@schemeidfont{#%app} proc-expr arg ...)], giving @schemeidfont{#%app}
|
||||
the lexical context that is associated with the original form (i.e.,
|
||||
the pair that combines @scheme[proc-expr] and its
|
||||
More precisely, the expander converts this form to
|
||||
@scheme[(@#,schemeidfont{#%app} proc-expr arg ...)], giving
|
||||
@schemeidfont{#%app} the lexical context that is associated with the
|
||||
original form (i.e., the pair that combines @scheme[proc-expr] and its
|
||||
arguments). Typically, the lexical context of the pair indicates the
|
||||
procedure-application @scheme[#%app] that is described next. See also
|
||||
@secref["expand-steps"].
|
||||
|
@ -1790,7 +1790,7 @@ A @scheme[case-clause] that starts with @scheme[else] must be the last
|
|||
([head id
|
||||
(head args)]
|
||||
[args (code:line arg ...)
|
||||
(code:line arg ... #, @schemeparenfont{.} rest-id)]
|
||||
(code:line arg ... @#,schemeparenfont{.} rest-id)]
|
||||
[arg arg-id
|
||||
[arg-id default-expr]
|
||||
(code:line keyword arg-id)
|
||||
|
@ -1805,7 +1805,7 @@ defined as follows:
|
|||
@schemeblock[
|
||||
(#,cvt (id . _kw-formals) . _datum) = (lambda _kw-formals . _datum)
|
||||
(#,cvt (head . _kw-formals) . _datum) = (lambda _kw-formals expr)
|
||||
#, @elem{if} (#,cvt head . _datum) = expr
|
||||
@#,elem{if} (#,cvt head . _datum) = expr
|
||||
]
|
||||
|
||||
At the top level, the top-level binding @scheme[id] is created after
|
||||
|
|
|
@ -89,7 +89,7 @@ Whether in ``text'' mode or Scheme mode, @litchar["@"] in a document
|
|||
provides an escape to Scheme mode. The syntax of @litchar["@"] is
|
||||
|
||||
@schemeblock[
|
||||
#, @BNF-seq[@litchar["@"]
|
||||
@#,BNF-seq[@litchar["@"]
|
||||
@nonterm{cmd}
|
||||
@litchar{[} @kleenestar{@nonterm{datum}} @litchar{]}
|
||||
@litchar["{"] @nonterm{text-body} @litchar["}"]]
|
||||
|
@ -114,14 +114,14 @@ A @nonterm{cmd} or @nonterm{datum} is a Scheme datum, while a
|
|||
The expansion of @litchar["@"]@nonterm{cmd} into Scheme code is
|
||||
|
||||
@schemeblock[
|
||||
#, @nonterm{cmd}
|
||||
@#,nonterm{cmd}
|
||||
]
|
||||
|
||||
When either @litchar{[} @litchar{]} or @litchar["{"] @litchar["}"]
|
||||
are used, the expansion is
|
||||
|
||||
@schemeblock[
|
||||
(#, @nonterm{cmd} #, @kleenestar{@nonterm{datum}} #, @kleenestar{@nonterm{parsed-body}})
|
||||
(@#,nonterm{cmd} @#,kleenestar{@nonterm{datum}} @#,kleenestar{@nonterm{parsed-body}})
|
||||
]
|
||||
|
||||
where @kleenestar{@nonterm{parsed-body}} is the parse result of the
|
||||
|
|
|
@ -92,8 +92,11 @@ A few other escapes are recognized symbolically:
|
|||
produces a paragraph using @scheme[t]:
|
||||
|
||||
@verbatim[#:indent 2]|{
|
||||
(code:comment #, @t{this is a comment})
|
||||
}|}
|
||||
(code:comment @#,t{this is a comment})
|
||||
}|
|
||||
|
||||
(Note that @litchar|{@#,foo{...}}| reads as @scheme[(unsyntax (foo "..."))].)
|
||||
}
|
||||
|
||||
@item{@schemeidfont{code:blank} typesets as a blank space.}
|
||||
|
||||
|
@ -366,8 +369,8 @@ sub-sections.}
|
|||
(keyword arg-id contract-expr-datum default-expr)
|
||||
ellipses
|
||||
ellipses+]
|
||||
[ellipses #, @lit-ellipses]
|
||||
[ellipses+ #, @lit-ellipses+])]{
|
||||
[ellipses @#,lit-ellipses]
|
||||
[ellipses+ @#,lit-ellipses+])]{
|
||||
|
||||
Produces a sequence of flow elements (encapsulated in a
|
||||
@scheme[splice]) to document a procedure named @scheme[id]. Nesting
|
||||
|
@ -402,13 +405,13 @@ Each @scheme[arg-spec] must have one of the following forms:
|
|||
Like the previous case, but with a default
|
||||
value.}
|
||||
|
||||
@specsubform[#, @lit-ellipses]{Any number of the preceding argument. This
|
||||
@specsubform[@#,lit-ellipses]{Any number of the preceding argument. This
|
||||
form is normally used at the end, but keyword-based arguments
|
||||
can sensibly appear afterward. See also the documentation for
|
||||
@scheme[append] for a use of @lit-ellipses before the last
|
||||
argument.}
|
||||
|
||||
@specsubform[#, @lit-ellipses+]{One or more of the preceding argument
|
||||
@specsubform[@#,lit-ellipses+]{One or more of the preceding argument
|
||||
(normally at the end, like @lit-ellipses).}
|
||||
|
||||
The @scheme[result-contract-expr-datum] is typeset via
|
||||
|
|
|
@ -19,8 +19,8 @@ the least-used characters in Scheme code.
|
|||
You can use the reader via Scheme's @schemefont{#reader} form:
|
||||
|
||||
@schemeblock[
|
||||
#, @schemefont|{
|
||||
#reader scribble/reader @foo{This is free-form text!}
|
||||
@#,schemefont|{
|
||||
#reader scribble/reader @foo{This is free-form text!}
|
||||
}|]
|
||||
|
||||
or use the @scheme[at-exp] meta-language as described in
|
||||
|
@ -60,10 +60,10 @@ function to switch the current readtable to a readtable that parses
|
|||
Informally, the concrete syntax of @"@"-forms is
|
||||
|
||||
@schemeblock[
|
||||
#, @BNF-seq[@litchar["@"]
|
||||
@nonterm{cmd}
|
||||
@litchar{[} @kleenestar{@nonterm{datum}} @litchar{]}
|
||||
@litchar["{"] @kleenestar{@nonterm{text-body}} @litchar["}"]]
|
||||
@#,BNF-seq[@litchar["@"]
|
||||
@nonterm{cmd}
|
||||
@litchar{[} @kleenestar{@nonterm{datum}} @litchar{]}
|
||||
@litchar["{"] @kleenestar{@nonterm{text-body}} @litchar["}"]]
|
||||
]
|
||||
|
||||
where all three parts after @litchar["@"] are optional, but at least
|
||||
|
@ -71,7 +71,7 @@ one should be present. (Note that spaces are not allowed between the
|
|||
three parts.) Roughly, a form matching the above grammar is read as
|
||||
|
||||
@schemeblock[
|
||||
(#, @nonterm{cmd} #, @kleenestar{@nonterm{datum}} #, @kleenestar{@nonterm{parsed-body}})
|
||||
(@#,nonterm{cmd} @#,kleenestar{@nonterm{datum}} @#,kleenestar{@nonterm{parsed-body}})
|
||||
]
|
||||
|
||||
where @nonterm{parsed-body} is the translation of each
|
||||
|
@ -289,9 +289,9 @@ comment. There are two comment forms, one for arbitrary-text and
|
|||
possibly nested comments, and another one for line comments:
|
||||
|
||||
@schemeblock[
|
||||
#, @BNF-seq[@litchar["@;{"] @kleenestar{@nonterm{any}} @litchar["}"]]
|
||||
@#,BNF-seq[@litchar["@;{"] @kleenestar{@nonterm{any}} @litchar["}"]]
|
||||
|
||||
#, @BNF-seq[@litchar["@;"] @kleenestar{@nonterm{anything-else-without-newline}}]
|
||||
@#,BNF-seq[@litchar["@;"] @kleenestar{@nonterm{anything-else-without-newline}}]
|
||||
]
|
||||
|
||||
In the first form, the commented body must still parse correctly; see
|
||||
|
@ -620,12 +620,12 @@ can be used to identify newlines in the original @nonterm{text-body}.
|
|||
@; FIXME: unfortunate code duplication (again):
|
||||
@interaction[
|
||||
(eval:alts
|
||||
(let ([nl (car #, @tt["@'{"]
|
||||
#, @tt[" }"])])
|
||||
(let ([nl (car @#,tt["@'{"]
|
||||
@#,tt[" }"])])
|
||||
(for-each (lambda (x) (display (if (eq? x nl) "\n... " x)))
|
||||
#, @tt["@`{foo"]
|
||||
#, @elem[@tt[" @"] @scheme[,@(list "bar" "\n" "baz")]]
|
||||
#, @tt[" blah}}"])
|
||||
@#,tt["@`{foo"]
|
||||
@#,elem[@tt[" @"] @scheme[,@(list "bar" "\n" "baz")]]
|
||||
@#,tt[" blah}}"])
|
||||
(newline))
|
||||
(let ([nl (car @'{
|
||||
})])
|
||||
|
@ -785,7 +785,7 @@ example, implicitly quoted keywords:
|
|||
(cddr xs))))])))
|
||||
(eval:alts
|
||||
(code:line
|
||||
#, @tt["@foo[x 1 y (* 2 3)]{blah}"])
|
||||
@#,tt["@foo[x 1 y (* 2 3)]{blah}"])
|
||||
;; Unfortunately, expressions are preserved by `def+int'
|
||||
;; using `quote', not `quote-syntax' (which would create all sorts
|
||||
;; or binding trouble), so we manually re-attach the property:
|
||||
|
@ -827,10 +827,10 @@ is an example of this.
|
|||
rst)])))))]))
|
||||
(eval:alts
|
||||
(code:line
|
||||
#, @tt["@verb[string-append]{"]
|
||||
#, @tt[" foo"]
|
||||
#, @tt[" bar"]
|
||||
#, @tt["}"])
|
||||
@#,tt["@verb[string-append]{"]
|
||||
@#,tt[" foo"]
|
||||
@#,tt[" bar"]
|
||||
@#,tt["}"])
|
||||
@verb[string-append]{
|
||||
foo
|
||||
bar
|
||||
|
@ -845,13 +845,13 @@ is an example of this.
|
|||
another language that is specified immediate after
|
||||
@schememodname[at-exp].}
|
||||
|
||||
For example, @scheme[#, @hash-lang[] at-exp scheme/base] adds @"@"-reader
|
||||
For example, @scheme[@#,hash-lang[] at-exp scheme/base] adds @"@"-reader
|
||||
support to @scheme[scheme/base], so that
|
||||
|
||||
@schememod[
|
||||
at-exp scheme/base
|
||||
|
||||
(define (greet who) #, @elem{@tt["@"]@scheme[string-append]@schemeparenfont["{"]@schemevalfont{Hello, }@tt["@|"]@scheme[who]@tt["|"]@schemevalfont{.}@schemeparenfont["}"]})
|
||||
(define (greet who) @#,elem{@tt["@"]@scheme[string-append]@schemeparenfont["{"]@schemevalfont{Hello, }@tt["@|"]@scheme[who]@tt["|"]@schemevalfont{.}@schemeparenfont["}"]})
|
||||
(greet "friend")]
|
||||
|
||||
reports @scheme["Hello, friend."].
|
||||
|
|
|
@ -138,14 +138,14 @@ returns the corresponding init arg.
|
|||
This mixin uses a struct definition for its settings:
|
||||
@schemeblock[
|
||||
(define-struct drscheme:language:simple-settings
|
||||
(case-sensitive (code:comment #, @t{boolean?})
|
||||
printing-style (code:comment #, @t{(symbols 'constructor 'quasiquote 'write 'print)})
|
||||
fraction-style (code:comment #, @t{(symbols 'mixed-fraction 'mixed-fraction-e})
|
||||
(code:comment #, @t{ 'repeating-decimal 'repeating-decimal-e)})
|
||||
show-sharing (code:comment #, @t{boolean?})
|
||||
insert-newlines (code:comment #, @t{boolean?})
|
||||
annotations)) (code:comment #, @t{(symbols 'none 'debug 'debug/profile})
|
||||
(code:comment #, @t{ 'test-coverage)})
|
||||
(case-sensitive (code:comment @#,t{boolean?})
|
||||
printing-style (code:comment @#,t{(symbols 'constructor 'quasiquote 'write 'print)})
|
||||
fraction-style (code:comment @#,t{(symbols 'mixed-fraction 'mixed-fraction-e})
|
||||
(code:comment @#,t{ 'repeating-decimal 'repeating-decimal-e)})
|
||||
show-sharing (code:comment @#,t{boolean?})
|
||||
insert-newlines (code:comment @#,t{boolean?})
|
||||
annotations)) (code:comment @#,t{(symbols 'none 'debug 'debug/profile})
|
||||
(code:comment @#,t{ 'test-coverage)})
|
||||
]
|
||||
|
||||
The settings in this structure reflect the settings show in
|
||||
|
|
|
@ -62,7 +62,7 @@ which can be implemented as libraries. To import the bindings of SRFI
|
|||
@math{n}, use
|
||||
|
||||
@schemeblock[
|
||||
(require #, @elem{@schemeidfont{srfi/}@math{n}})
|
||||
(require @#,elem{@schemeidfont{srfi/}@math{n}})
|
||||
]
|
||||
|
||||
This document lists the SRFIs that are supported by PLT Scheme and
|
||||
|
|
|
@ -92,7 +92,7 @@ The following functions allow programs to react to events from the canvas.
|
|||
|
||||
@defproc[(on-key-event [change (-> (unsyntax @tech{DrawKeyEvent}) (unsyntax @tech{DrawWorld}) (unsyntax @tech{DrawWorld}))])
|
||||
true]{Adds @scheme[change] to the world. The function reacts to keyboard
|
||||
events and creates a new @scheme[#, @tech{DrawWorld}].}
|
||||
events and creates a new @scheme[@#,tech{DrawWorld}].}
|
||||
|
||||
@defproc[(on-tick-event [tock (-> (unsyntax @tech{DrawWorld}) (unsyntax @tech{DrawWorld}))]) true]{Adds @scheme[tock]
|
||||
to the world. The function reacts to clock tick events, creating a new
|
||||
|
|
|
@ -233,7 +233,7 @@ and converts a list of colors into an image.
|
|||
#reader scribble/comment-reader
|
||||
(schemeblock
|
||||
;; -- @scheme[empty]
|
||||
;; -- @scheme[(cons #, @tech{Color} List-of-color)]
|
||||
;; -- @scheme[(cons @#,tech{Color} List-of-color)]
|
||||
;; Interpretation: represents a list of colors.
|
||||
))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user