From fbea19f35c92a3fb56fd9d5ebb605ef4c584e8e6 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 22 Apr 2010 10:08:03 -0600 Subject: [PATCH 01/43] toward scriblle qq --- collects/scribble/eval.ss | 4 ++-- collects/scribble/run.ss | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/collects/scribble/eval.ss b/collects/scribble/eval.ss index 945de315c3..603c7201be 100644 --- a/collects/scribble/eval.ss +++ b/collects/scribble/eval.ss @@ -118,7 +118,7 @@ (list (hspace 2) (elem #:style result-color - (to-element/no-color v)))))))) + (to-element/no-color v #:qq? (print-as-quasiquote))))))))) val-list)))) (loop (cdr expr-paras) (cdr val-list+outputs) @@ -314,7 +314,7 @@ (define (show-val v) (elem #:style result-color - (to-element/no-color v))) + (to-element/no-color v #:qq? (print-as-quasiquote)))) (define (do-interaction-eval-show ev e) (parameterize ([current-command-line-arguments #()]) diff --git a/collects/scribble/run.ss b/collects/scribble/run.ss index c171c7b76c..31874f87cb 100644 --- a/collects/scribble/run.ss +++ b/collects/scribble/run.ss @@ -1,4 +1,4 @@ -#lang scheme/base +#lang racket/base (require "core.ss" "base-render.ss" From c76cee4775e54abde5c018794e65419dd773eea8 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 22 Apr 2010 12:10:41 -0600 Subject: [PATCH 02/43] fix error reporting for chdir in forked process --- src/racket/src/port.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/racket/src/port.c b/src/racket/src/port.c index ceed35225d..02b44cf8ab 100644 --- a/src/racket/src/port.c +++ b/src/racket/src/port.c @@ -7792,7 +7792,10 @@ static Scheme_Object *subprocess(int c, Scheme_Object *args[]) { Scheme_Object *dir; dir = scheme_get_param(scheme_current_config(), MZCONFIG_CURRENT_DIRECTORY); - scheme_os_setcwd(SCHEME_PATH_VAL(dir), 0); + if (!scheme_os_setcwd(SCHEME_PATH_VAL(dir), 1)) { + scheme_console_printf("racket: chdir failed to: %s\n", SCHEME_BYTE_STR_VAL(dir)); + _exit(1); + } } /* Exec new process */ @@ -7816,7 +7819,7 @@ static Scheme_Object *subprocess(int c, Scheme_Object *args[]) /* using scheme_signal_error will leave us in the forked process, so use scheme_console_printf instead */ - scheme_console_printf("mzscheme: exec failed (%d)\n", err); + scheme_console_printf("racket: exec failed (%d)\n", err); /* back to MzScheme signal dispositions: */ START_XFORM_SKIP; From 82eb64451d260d199b29cee011de2959d2150b92 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 22 Apr 2010 12:12:34 -0600 Subject: [PATCH 03/43] switch default configuration to have qq printing enabled, add runtime-config for scheme languages --- collects/racket/gui/lang/reader.ss | 2 + collects/racket/runtime-config.rkt | 3 - collects/scheme/base.rkt | 4 +- collects/scheme/base/lang/reader.ss | 2 + collects/scheme/gui/lang/reader.ss | 2 + collects/scheme/init.rkt | 25 +++--- collects/scheme/lang/reader.ss | 2 + collects/scheme/language-info.ss | 10 +++ collects/scheme/main.rkt | 101 +++++++++++++------------ collects/scheme/private/lang/reader.ss | 4 + collects/scheme/runtime-config.ss | 7 ++ src/racket/src/thread.c | 2 +- 12 files changed, 96 insertions(+), 68 deletions(-) create mode 100644 collects/scheme/language-info.ss create mode 100644 collects/scheme/private/lang/reader.ss create mode 100644 collects/scheme/runtime-config.ss diff --git a/collects/racket/gui/lang/reader.ss b/collects/racket/gui/lang/reader.ss index 48151efe84..c883c78807 100644 --- a/collects/racket/gui/lang/reader.ss +++ b/collects/racket/gui/lang/reader.ss @@ -1,2 +1,4 @@ #lang s-exp syntax/module-reader racket/gui + +#:language-info '#(racket/language-info get-info #f) diff --git a/collects/racket/runtime-config.rkt b/collects/racket/runtime-config.rkt index 9d25c7f336..572d8a496b 100644 --- a/collects/racket/runtime-config.rkt +++ b/collects/racket/runtime-config.rkt @@ -4,7 +4,4 @@ (define-values (configure) (lambda (config) - (current-prompt-read (lambda () - (printf "> ") - (read))) (print-as-quasiquote #t)))) diff --git a/collects/scheme/base.rkt b/collects/scheme/base.rkt index 4df2ad6ca4..30bbd6da23 100644 --- a/collects/scheme/base.rkt +++ b/collects/scheme/base.rkt @@ -1,3 +1,3 @@ +#lang scheme/private -(module base racket/base - (provide (except-out (all-from-out racket/base) struct))) +(provide (except-out (all-from-out racket/base) struct)) diff --git a/collects/scheme/base/lang/reader.ss b/collects/scheme/base/lang/reader.ss index 437c168fa2..385a10d750 100644 --- a/collects/scheme/base/lang/reader.ss +++ b/collects/scheme/base/lang/reader.ss @@ -1,2 +1,4 @@ #lang s-exp syntax/module-reader scheme/base + +#:language-info '#(scheme/language-info get-info #f) diff --git a/collects/scheme/gui/lang/reader.ss b/collects/scheme/gui/lang/reader.ss index 186a775bcc..140e7eadd5 100644 --- a/collects/scheme/gui/lang/reader.ss +++ b/collects/scheme/gui/lang/reader.ss @@ -1,2 +1,4 @@ #lang s-exp syntax/module-reader scheme/gui + +#:language-info '#(scheme/language-info get-info #f) diff --git a/collects/scheme/init.rkt b/collects/scheme/init.rkt index 68ea88f6a5..60023bfa5a 100644 --- a/collects/scheme/init.rkt +++ b/collects/scheme/init.rkt @@ -1,16 +1,17 @@ +#lang scheme -(module init scheme - (require "enter.ss" - "help.ss") +(require "enter.ss" + "help.ss") - ;; Set the printer: - (current-print (let ([pretty-printer - (lambda (v) - (unless (void? v) - (pretty-print v)))]) - pretty-printer)) +;; Set the printer: +(current-print (let ([pretty-printer + (lambda (v) + (unless (void? v) + (pretty-print v)))]) + pretty-printer)) + +(provide (all-from-out scheme + "enter.ss" + "help.ss")) - (provide (all-from-out scheme - "enter.ss" - "help.ss"))) diff --git a/collects/scheme/lang/reader.ss b/collects/scheme/lang/reader.ss index 45e4598b18..b3c8466439 100644 --- a/collects/scheme/lang/reader.ss +++ b/collects/scheme/lang/reader.ss @@ -1,2 +1,4 @@ #lang s-exp syntax/module-reader scheme + +#:language-info '#(scheme/language-info get-info #f) diff --git a/collects/scheme/language-info.ss b/collects/scheme/language-info.ss new file mode 100644 index 0000000000..bbaf009c19 --- /dev/null +++ b/collects/scheme/language-info.ss @@ -0,0 +1,10 @@ +(module language-info racket/base + + (provide get-info) + + (define (get-info data) + (lambda (key default) + (case key + [(configure-runtime) + '(#(scheme/runtime-config configure #f))] + [else default])))) diff --git a/collects/scheme/main.rkt b/collects/scheme/main.rkt index d7eeb6af09..ab98086116 100644 --- a/collects/scheme/main.rkt +++ b/collects/scheme/main.rkt @@ -1,51 +1,52 @@ -(module main scheme/base - (require scheme/contract - scheme/class - scheme/unit - scheme/dict - scheme/include - scheme/pretty - scheme/math - scheme/match - scheme/shared - scheme/tcp - scheme/udp - scheme/list - scheme/vector - scheme/string - scheme/function - scheme/path - scheme/file - scheme/port - scheme/cmdline - scheme/promise - scheme/bool - scheme/local - scheme/nest - (for-syntax scheme/base)) +#lang scheme/base - (provide (all-from-out scheme/contract - scheme/class - scheme/unit - scheme/dict - scheme/include - scheme/pretty - scheme/math - scheme/match - scheme/shared - scheme/base - scheme/tcp - scheme/udp - scheme/list - scheme/vector - scheme/string - scheme/function - scheme/path - scheme/file - scheme/port - scheme/cmdline - scheme/promise - scheme/bool - scheme/local - scheme/nest) - (for-syntax (all-from-out scheme/base)))) +(require scheme/contract + scheme/class + scheme/unit + scheme/dict + scheme/include + scheme/pretty + scheme/math + scheme/match + scheme/shared + scheme/tcp + scheme/udp + scheme/list + scheme/vector + scheme/string + scheme/function + scheme/path + scheme/file + scheme/port + scheme/cmdline + scheme/promise + scheme/bool + scheme/local + scheme/nest + (for-syntax scheme/base)) + +(provide (all-from-out scheme/contract + scheme/class + scheme/unit + scheme/dict + scheme/include + scheme/pretty + scheme/math + scheme/match + scheme/shared + scheme/base + scheme/tcp + scheme/udp + scheme/list + scheme/vector + scheme/string + scheme/function + scheme/path + scheme/file + scheme/port + scheme/cmdline + scheme/promise + scheme/bool + scheme/local + scheme/nest) + (for-syntax (all-from-out scheme/base))) diff --git a/collects/scheme/private/lang/reader.ss b/collects/scheme/private/lang/reader.ss new file mode 100644 index 0000000000..7bb7112c38 --- /dev/null +++ b/collects/scheme/private/lang/reader.ss @@ -0,0 +1,4 @@ +#lang s-exp syntax/module-reader +racket/base + +#:language-info '#(scheme/language-info get-info #f) diff --git a/collects/scheme/runtime-config.ss b/collects/scheme/runtime-config.ss new file mode 100644 index 0000000000..f61c5daded --- /dev/null +++ b/collects/scheme/runtime-config.ss @@ -0,0 +1,7 @@ +(module runtime-config '#%kernel + + (#%provide configure) + + (define-values (configure) + (lambda (config) + (print-as-quasiquote #f)))) diff --git a/src/racket/src/thread.c b/src/racket/src/thread.c index dc5f3e3c1a..b6e028718d 100644 --- a/src/racket/src/thread.c +++ b/src/racket/src/thread.c @@ -6625,7 +6625,7 @@ static void make_initial_config(Scheme_Thread *p) init_param(cells, paramz, MZCONFIG_PRINT_PAIR_CURLY, scheme_false); init_param(cells, paramz, MZCONFIG_PRINT_MPAIR_CURLY, scheme_true); init_param(cells, paramz, MZCONFIG_PRINT_READER, scheme_false); - init_param(cells, paramz, MZCONFIG_PRINT_AS_QQ, scheme_false); + init_param(cells, paramz, MZCONFIG_PRINT_AS_QQ, scheme_true); init_param(cells, paramz, MZCONFIG_PRINT_SYNTAX_WIDTH, scheme_make_integer(32)); init_param(cells, paramz, MZCONFIG_HONU_MODE, scheme_false); From c7e723eef7d26e767dfee32496211e3ea5b8470e Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 22 Apr 2010 13:58:03 -0600 Subject: [PATCH 04/43] somewhat rackety core docs --- collects/racket/private/namespace.rkt | 4 +- .../lang.ss => racket/signature/lang.rkt} | 0 collects/racket/signature/lang/reader.ss | 2 + .../unit/lang.ss => racket/unit/lang.rkt} | 0 collects/racket/unit/lang/reader.ss | 2 + collects/scheme/signature/lang/reader.ss | 2 +- collects/scheme/unit/lang/reader.ss | 2 +- collects/scribble/eval.ss | 82 +++--- collects/scribble/private/manual-scheme.ss | 107 +++++--- collects/scribble/private/manual-style.ss | 56 ++-- collects/scribble/scheme.ss | 3 +- collects/scribble/search.ss | 9 +- collects/scribble/urls.ss | 14 +- collects/scribblings/foreign/foreign.scrbl | 9 +- collects/scribblings/foreign/intro.scrbl | 24 +- collects/scribblings/foreign/unsafe.scrbl | 25 -- collects/scribblings/foreign/utils.ss | 16 +- collects/scribblings/gui/dynamic.scrbl | 20 +- collects/scribblings/gui/gui.scrbl | 18 +- collects/scribblings/quick/images/exprs.dat | 60 ++--- collects/scribblings/quick/images/img0.pdf | Bin 2520 -> 2520 bytes collects/scribblings/quick/images/img1.pdf | Bin 2474 -> 2474 bytes collects/scribblings/quick/images/img10.pdf | 14 +- collects/scribblings/quick/images/img11.pdf | Bin 2507 -> 2507 bytes collects/scribblings/quick/images/img12.pdf | Bin 3655 -> 3655 bytes collects/scribblings/quick/images/img13.pdf | Bin 2851 -> 2851 bytes collects/scribblings/quick/images/img14.pdf | 14 +- collects/scribblings/quick/images/img15.pdf | Bin 2843 -> 2843 bytes collects/scribblings/quick/images/img16.pdf | 14 +- collects/scribblings/quick/images/img17.pdf | Bin 2520 -> 2520 bytes collects/scribblings/quick/images/img18.pdf | Bin 2474 -> 2474 bytes collects/scribblings/quick/images/img19.pdf | Bin 2473 -> 2473 bytes collects/scribblings/quick/images/img2.pdf | 14 +- collects/scribblings/quick/images/img20.pdf | Bin 2482 -> 2482 bytes collects/scribblings/quick/images/img21.pdf | Bin 2475 -> 2475 bytes collects/scribblings/quick/images/img22.pdf | Bin 2476 -> 2476 bytes collects/scribblings/quick/images/img23.pdf | Bin 2475 -> 2475 bytes collects/scribblings/quick/images/img24.pdf | Bin 2497 -> 2497 bytes collects/scribblings/quick/images/img25.pdf | 14 +- collects/scribblings/quick/images/img26.pdf | 14 +- collects/scribblings/quick/images/img27.pdf | Bin 4535 -> 4535 bytes collects/scribblings/quick/images/img28.pdf | Bin 4599 -> 4599 bytes collects/scribblings/quick/images/img29.pdf | Bin 12588 -> 12588 bytes collects/scribblings/quick/images/img3.pdf | Bin 2474 -> 2474 bytes collects/scribblings/quick/images/img4.pdf | 14 +- collects/scribblings/quick/images/img5.pdf | Bin 2578 -> 2578 bytes collects/scribblings/quick/images/img6.pdf | Bin 2474 -> 2474 bytes collects/scribblings/quick/images/img7.pdf | Bin 2623 -> 2623 bytes collects/scribblings/quick/images/img8.pdf | Bin 2502 -> 2502 bytes collects/scribblings/quick/images/img9.pdf | Bin 2852 -> 2852 bytes collects/scribblings/quick/mreval.ss | 6 +- collects/scribblings/quick/quick.scrbl | 250 +++++++++--------- .../reference/async-channels.scrbl | 6 +- collects/scribblings/reference/booleans.scrbl | 2 +- collects/scribblings/reference/class.scrbl | 12 +- collects/scribblings/reference/cmdline.scrbl | 4 +- .../scribblings/reference/concurrency.scrbl | 2 +- .../scribblings/reference/contracts.scrbl | 4 +- .../scribblings/reference/control-lib.scrbl | 10 +- .../scribblings/reference/define-struct.scrbl | 82 ++++-- collects/scribblings/reference/dicts.scrbl | 4 +- .../scribblings/reference/encodings.scrbl | 2 +- collects/scribblings/reference/enter.scrbl | 6 +- .../scribblings/reference/eval-model.scrbl | 2 +- collects/scribblings/reference/exns.scrbl | 2 +- .../scribblings/reference/file-ports.scrbl | 6 +- .../scribblings/reference/filesystem.scrbl | 12 +- collects/scribblings/reference/futures.scrbl | 11 +- collects/scribblings/reference/help.scrbl | 12 +- collects/scribblings/reference/include.scrbl | 2 +- collects/scribblings/reference/init.scrbl | 18 +- .../scribblings/reference/load-lang.scrbl | 30 +-- collects/scribblings/reference/logging.scrbl | 2 +- collects/scribblings/reference/match-parse.ss | 4 +- collects/scribblings/reference/match.scrbl | 6 +- collects/scribblings/reference/mpairs.scrbl | 4 +- collects/scribblings/reference/mz.ss | 30 +-- .../scribblings/reference/namespaces.scrbl | 4 +- .../scribblings/reference/networking.scrbl | 4 +- collects/scribblings/reference/numbers.scrbl | 38 +-- collects/scribblings/reference/package.scrbl | 8 +- collects/scribblings/reference/pairs.scrbl | 10 +- collects/scribblings/reference/paths.scrbl | 4 +- collects/scribblings/reference/port-lib.scrbl | 4 +- .../scribblings/reference/pretty-print.scrbl | 2 +- .../scribblings/reference/procedures.scrbl | 6 +- collects/scribblings/reference/promise.scrbl | 4 +- .../scribblings/reference/reader-example.ss | 4 +- .../scribblings/reference/reference.scrbl | 17 +- collects/scribblings/reference/sandbox.scrbl | 26 +- .../scribblings/reference/sequences.scrbl | 8 +- .../scribblings/reference/serialization.scrbl | 8 +- collects/scribblings/reference/sets.scrbl | 4 +- collects/scribblings/reference/shared.scrbl | 8 +- collects/scribblings/reference/splicing.scrbl | 14 +- collects/scribblings/reference/startup.scrbl | 22 +- collects/scribblings/reference/strings.scrbl | 4 +- collects/scribblings/reference/struct.scrbl | 4 +- .../scribblings/reference/stx-param.scrbl | 20 +- .../scribblings/reference/stx-patterns.scrbl | 12 +- .../scribblings/reference/stx-trans.scrbl | 16 +- .../scribblings/reference/subprocess.scrbl | 6 +- .../scribblings/reference/surrogate.scrbl | 8 +- .../scribblings/reference/syntax-model.scrbl | 6 +- collects/scribblings/reference/syntax.scrbl | 78 +++--- collects/scribblings/reference/time.scrbl | 6 +- collects/scribblings/reference/units.scrbl | 63 +++-- collects/scribblings/reference/unsafe.scrbl | 12 +- collects/scribblings/reference/vectors.scrbl | 4 +- collects/scribblings/scheme/info.ss | 3 + collects/scribblings/scheme/scheme.scrbl | 124 +++++++++ collects/scriblib/gui-eval.ss | 21 +- collects/slideshow/main.ss | 4 +- 113 files changed, 909 insertions(+), 761 deletions(-) rename collects/{scheme/signature/lang.ss => racket/signature/lang.rkt} (100%) create mode 100644 collects/racket/signature/lang/reader.ss rename collects/{scheme/unit/lang.ss => racket/unit/lang.rkt} (100%) create mode 100644 collects/racket/unit/lang/reader.ss create mode 100644 collects/scribblings/scheme/info.ss create mode 100644 collects/scribblings/scheme/scheme.scrbl diff --git a/collects/racket/private/namespace.rkt b/collects/racket/private/namespace.rkt index c8b87be730..8d79ad8fad 100644 --- a/collects/racket/private/namespace.rkt +++ b/collects/racket/private/namespace.rkt @@ -19,14 +19,14 @@ [ns (parameterize ([current-namespace this-ns]) ; ensures correct phase (make-empty-namespace))]) (namespace-attach-module this-ns - 'scheme/base + 'racket/base ns) ns)) (define (make-base-namespace) (let ([ns (make-base-empty-namespace)]) (parameterize ([current-namespace ns]) - (namespace-require 'scheme/base)) + (namespace-require 'racket/base)) ns)) ;; ---------------------------------------- diff --git a/collects/scheme/signature/lang.ss b/collects/racket/signature/lang.rkt similarity index 100% rename from collects/scheme/signature/lang.ss rename to collects/racket/signature/lang.rkt diff --git a/collects/racket/signature/lang/reader.ss b/collects/racket/signature/lang/reader.ss new file mode 100644 index 0000000000..363b95d86f --- /dev/null +++ b/collects/racket/signature/lang/reader.ss @@ -0,0 +1,2 @@ +#lang s-exp syntax/module-reader +racket/signature/lang diff --git a/collects/scheme/unit/lang.ss b/collects/racket/unit/lang.rkt similarity index 100% rename from collects/scheme/unit/lang.ss rename to collects/racket/unit/lang.rkt diff --git a/collects/racket/unit/lang/reader.ss b/collects/racket/unit/lang/reader.ss new file mode 100644 index 0000000000..9d47cb1147 --- /dev/null +++ b/collects/racket/unit/lang/reader.ss @@ -0,0 +1,2 @@ +#lang s-exp syntax/module-reader +racket/unit/lang diff --git a/collects/scheme/signature/lang/reader.ss b/collects/scheme/signature/lang/reader.ss index c8ddd4d63c..363b95d86f 100644 --- a/collects/scheme/signature/lang/reader.ss +++ b/collects/scheme/signature/lang/reader.ss @@ -1,2 +1,2 @@ #lang s-exp syntax/module-reader -scheme/signature/lang +racket/signature/lang diff --git a/collects/scheme/unit/lang/reader.ss b/collects/scheme/unit/lang/reader.ss index 2d0a549281..9d47cb1147 100644 --- a/collects/scheme/unit/lang/reader.ss +++ b/collects/scheme/unit/lang/reader.ss @@ -1,2 +1,2 @@ #lang s-exp syntax/module-reader -scheme/unit/lang +racket/unit/lang diff --git a/collects/scribble/eval.ss b/collects/scribble/eval.ss index 603c7201be..c2c01634c4 100644 --- a/collects/scribble/eval.ss +++ b/collects/scribble/eval.ss @@ -1,20 +1,20 @@ -(module eval scheme/base +(module eval racket/base (require "manual.ss" "struct.ss" "scheme.ss" "decode.ss" - scheme/file + racket/file scheme/sandbox - scheme/promise + racket/promise mzlib/string - (for-syntax scheme/base)) + (for-syntax racket/base)) (provide interaction interaction-eval interaction-eval-show - schemeblock+eval - schememod+eval + racketblock+eval (rename-out [racketblock+eval schemeblock+eval]) + racketmod+eval (rename-out [racketmod+eval schememod+eval]) def+int defs+int examples @@ -38,8 +38,8 @@ (define maxlen 60) - (namespace-require 'scheme/base) - (namespace-require '(for-syntax scheme/base)) + (namespace-require 'racket/base) + (namespace-require '(for-syntax racket/base)) (define (literal-string style s) (let ([m (regexp-match #rx"^(.*)( +)(.*)$" s)]) @@ -325,31 +325,31 @@ [(_ #:eval ev e) (do-interaction-eval-show ev (quote-expr e))] [(_ e) (do-interaction-eval-show #f (quote-expr e))])) - (define-syntax schemeinput* + (define-syntax racketinput* (syntax-rules (eval:alts code:comment) - [(_ (code:comment . rest)) (schemeblock (code:comment . rest))] - [(_ (eval:alts a b)) (schemeinput* a)] - [(_ e) (schemeinput e)])) + [(_ (code:comment . rest)) (racketblock (code:comment . rest))] + [(_ (eval:alts a b)) (racketinput* a)] + [(_ e) (racketinput e)])) - (define-code schemeblock+line (to-paragraph/prefix (hspace 2) + (define-code racketblock+line (to-paragraph/prefix (hspace 2) (hspace 2) (list " "))) - (define-syntax (schemedefinput* stx) + (define-syntax (racketdefinput* stx) (syntax-case stx (define define-values define-struct) [(_ (define . rest)) (syntax-case stx () - [(_ e) #'(schemeblock+line e)])] + [(_ e) #'(racketblock+line e)])] [(_ (define-values . rest)) (syntax-case stx () - [(_ e) #'(schemeblock+line e)])] + [(_ e) #'(racketblock+line e)])] [(_ (define-struct . rest)) (syntax-case stx () - [(_ e) #'(schemeblock+line e)])] + [(_ e) #'(racketblock+line e)])] [(_ (code:line (define . rest) . rest2)) (syntax-case stx () - [(_ e) #'(schemeblock+line e)])] - [(_ e) #'(schemeinput* e)])) + [(_ e) #'(racketblock+line e)])] + [(_ e) #'(racketinput* e)])) (define (do-titled-interaction ev t shows evals) (interleave t @@ -358,41 +358,41 @@ (define-syntax titled-interaction (syntax-rules () - [(_ #:eval ev t schemeinput* e ...) - (do-titled-interaction ev t (list (schemeinput* e) ...) (list (quote-expr e) ...))] - [(_ t schemeinput* e ...) - (titled-interaction #:eval (make-base-eval) t schemeinput* e ...)])) + [(_ #:eval ev t racketinput* e ...) + (do-titled-interaction ev t (list (racketinput* e) ...) (list (quote-expr e) ...))] + [(_ t racketinput* e ...) + (titled-interaction #:eval (make-base-eval) t racketinput* e ...)])) (define-syntax interaction (syntax-rules () - [(_ #:eval ev e ...) (titled-interaction #:eval ev #f schemeinput* e ...)] - [(_ e ...) (titled-interaction #f schemeinput* e ...)])) + [(_ #:eval ev e ...) (titled-interaction #:eval ev #f racketinput* e ...)] + [(_ e ...) (titled-interaction #f racketinput* e ...)])) - (define-syntax schemeblock+eval + (define-syntax racketblock+eval (syntax-rules () [(_ #:eval ev e ...) (let ([eva ev]) (#%expression (begin (interaction-eval #:eval eva e) ... - (schemeblock e ...))))] + (racketblock e ...))))] [(_ e ...) - (schemeblock+eval #:eval (make-base-eval) e ...)])) + (racketblock+eval #:eval (make-base-eval) e ...)])) - (define-syntax schememod+eval + (define-syntax racketmod+eval (syntax-rules () [(_ #:eval ev name e ...) (let ([eva ev]) (#%expression (begin (interaction-eval #:eval eva e) ... - (schememod name e ...))))] + (racketmod name e ...))))] [(_ name e ...) - (schememod+eval #:eval (make-base-eval) name e ...)])) + (racketmod+eval #:eval (make-base-eval) name e ...)])) (define-syntax def+int (syntax-rules () [(_ #:eval ev def e ...) (let ([eva ev]) - (column (list (schemeblock+eval #:eval eva def) + (column (list (racketblock+eval #:eval eva def) blank-line (interaction #:eval eva e ...))))] [(_ def e ...) @@ -402,7 +402,7 @@ (syntax-rules () [(_ #:eval ev [def ...] e ...) (let ([eva ev]) - (column (list (schemeblock+eval #:eval eva def ...) + (column (list (racketblock+eval #:eval eva def ...) blank-line (interaction #:eval eva e ...))))] [(_ [def ...] e ...) @@ -421,27 +421,27 @@ (define-syntax examples (syntax-rules () [(_ #:eval ev e ...) - (titled-interaction #:eval ev (pick-example-title e ...) schemeinput* e ...)] + (titled-interaction #:eval ev (pick-example-title e ...) racketinput* e ...)] [(_ e ...) - (titled-interaction (pick-example-title e ...) schemeinput* e ...)])) + (titled-interaction (pick-example-title e ...) racketinput* e ...)])) (define-syntax examples* (syntax-rules () [(_ #:eval ev example-title e ...) - (titled-interaction #:eval ev example-title schemeinput* e ...)] + (titled-interaction #:eval ev example-title racketinput* e ...)] [(_ example-title e ...) - (titled-interaction example-title schemeinput* e ...)])) + (titled-interaction example-title racketinput* e ...)])) (define-syntax defexamples (syntax-rules () [(_ #:eval ev e ...) - (titled-interaction #:eval ev (pick-example-title e ...) schemedefinput* e ...)] + (titled-interaction #:eval ev (pick-example-title e ...) racketdefinput* e ...)] [(_ e ...) - (titled-interaction (pick-example-title e ...) schemedefinput* e ...)])) + (titled-interaction (pick-example-title e ...) racketdefinput* e ...)])) (define-syntax defexamples* (syntax-rules () [(_ #:eval ev example-title e ...) - (titled-interaction #:eval ev example-title schemedefinput* e ...)] + (titled-interaction #:eval ev example-title racketdefinput* e ...)] [(_ example-title e ...) - (titled-interaction example-title schemedefinput* e ...)])) + (titled-interaction example-title racketdefinput* e ...)])) (define blank-line (make-paragraph (list 'nbsp))) diff --git a/collects/scribble/private/manual-scheme.ss b/collects/scribble/private/manual-scheme.ss index 622b89d64f..016a2afdff 100644 --- a/collects/scribble/private/manual-scheme.ss +++ b/collects/scribble/private/manual-scheme.ss @@ -1,38 +1,57 @@ -#lang scheme/base +#lang racket/base (require "../decode.ss" "../struct.ss" "../scheme.ss" "../search.ss" "../basic.ss" - scheme/list + racket/list "manual-utils.ss" "manual-style.ss" - (for-syntax scheme/base) - (for-label scheme/base)) + (for-syntax racket/base) + (for-label racket/base)) -(provide schemeblock SCHEMEBLOCK schemeblock/form - schemeblock0 SCHEMEBLOCK0 schemeblock0/form - schemeblockelem - schemeinput - schememod - scheme SCHEME scheme/form schemeresult schemeid - schememodname - schememodlink indexed-scheme - schemelink) +(provide racketblock RACKETBLOCK racketblock/form + racketblock0 RACKETBLOCK0 racketblock0/form + racketblockelem + racketinput + racketmod + racket RACKET racket/form racketresult racketid + racketmodname + racketmodlink indexed-racket + racketlink + + (rename-out [racketblock schemeblock] + [RACKETBLOCK SCHEMEBLOCK] + [racketblock/form schemeblock/form] + [racketblock0 schemeblock0] + [RACKETBLOCK0 SCHEMEBLOCK0] + [racketblock0/form schemeblock0/form] + [racketblockelem schemeblockelem] + [racketinput schemeinput] + [racketmod schememod] + [racket scheme] + [RACKET SCHEME] + [racket/form scheme/form] + [racketresult schemeresult] + [racketid schemeid] + [racketmodname schememodname] + [racketmodlink schememodlink] + [indexed-racket indexed-scheme] + [racketlink schemelink])) -(define-code schemeblock0 to-paragraph) -(define-code schemeblock (to-paragraph/prefix (hspace 2) (hspace 2) "")) -(define-code SCHEMEBLOCK (to-paragraph/prefix (hspace 2) (hspace 2) "") +(define-code racketblock0 to-paragraph) +(define-code racketblock (to-paragraph/prefix (hspace 2) (hspace 2) "")) +(define-code RACKETBLOCK (to-paragraph/prefix (hspace 2) (hspace 2) "") UNSYNTAX) -(define-code SCHEMEBLOCK0 to-paragraph UNSYNTAX) +(define-code RACKETBLOCK0 to-paragraph UNSYNTAX) (define interaction-prompt (make-element 'tt (list "> " ))) -(define-code schemeinput +(define-code racketinput (to-paragraph/prefix (make-element #f (list (hspace 2) interaction-prompt)) (hspace 4) "")) -(define-syntax (schememod stx) +(define-syntax (racketmod stx) (syntax-case stx () [(_ #:file filename lang rest ...) (with-syntax ([modtag (datum->syntax @@ -45,7 +64,7 @@ `(as-modname-link ',#'lang (to-element ',#'lang)) - #'(scheme lang))))) + #'(racket lang))))) #'lang)] [(file ...) (if (syntax-e #'filename) @@ -55,9 +74,9 @@ `(code:comment (unsyntax (t "In \"" ,(syntax-e #'filename) "\":"))) #'filename)) null)]) - (syntax/loc stx (schemeblock file ... modtag rest ...)))] + (syntax/loc stx (racketblock file ... modtag rest ...)))] [(_ lang rest ...) - (syntax/loc stx (schememod #:file #f lang rest ...))])) + (syntax/loc stx (racketmod #:file #f lang rest ...))])) (define (to-element/result s) (make-element result-color (list (to-element/no-color s)))) @@ -91,25 +110,25 @@ (make-shaped-parens s val) s)) -(define-code schemeblockelem to-element) +(define-code racketblockelem to-element) -(define-code scheme to-element unsyntax keep-s-expr add-sq-prop) -(define-code SCHEME to-element UNSYNTAX keep-s-expr add-sq-prop) -(define-code schemeresult to-element/result unsyntax keep-s-expr add-sq-prop) -(define-code schemeid to-element/id unsyntax keep-s-expr add-sq-prop) -(define-code *schememodname to-element unsyntax keep-s-expr add-sq-prop) +(define-code racket to-element unsyntax keep-s-expr add-sq-prop) +(define-code RACKET to-element UNSYNTAX keep-s-expr add-sq-prop) +(define-code racketresult to-element/result unsyntax keep-s-expr add-sq-prop) +(define-code racketid to-element/id unsyntax keep-s-expr add-sq-prop) +(define-code *racketmodname to-element unsyntax keep-s-expr add-sq-prop) -(define-syntax schememodname +(define-syntax racketmodname (syntax-rules (unsyntax) - [(schememodname #,n) + [(racketmodname #,n) (let ([sym n]) (as-modname-link sym (to-element sym)))] - [(schememodname n) - (as-modname-link 'n (*schememodname n))])) + [(racketmodname n) + (as-modname-link 'n (*racketmodname n))])) -(define-syntax schememodlink +(define-syntax racketmodlink (syntax-rules (unsyntax) - [(schememodlink n content ...) + [(racketmodlink n content ...) (*as-modname-link 'n (elem #:style #f content ...))])) (define (as-modname-link s e) @@ -122,10 +141,10 @@ (list e) `(mod-path ,(format "~s" s)))) -(define-syntax-rule (indexed-scheme x) - (add-scheme-index 'x (scheme x))) +(define-syntax-rule (indexed-racket x) + (add-racket-index 'x (racket x))) -(define (add-scheme-index s e) +(define (add-racket-index s e) (let ([k (cond [(and (pair? s) (eq? (car s) 'quote)) (format "~s" (cadr s))] [(string? s) s] [else (format "~s" s)])]) @@ -139,11 +158,11 @@ #'(let ([ellipses #f]) (base a)))]))) -(define-/form schemeblock0/form schemeblock0) -(define-/form schemeblock/form schemeblock) -(define-/form scheme/form scheme) +(define-/form racketblock0/form racketblock0) +(define-/form racketblock/form racketblock) +(define-/form racket/form racket) -(define (*schemelink stx-id id . s) +(define (*racketlink stx-id id . s) (let ([content (decode-content s)]) (make-delayed-element (lambda (r p ri) @@ -151,11 +170,11 @@ (make-link-element #f content - (or (find-scheme-tag p ri stx-id #f) + (or (find-racket-tag p ri stx-id #f) `(undef ,(format "--UNDEFINED:~a--" (syntax-e stx-id))))))) (lambda () content) (lambda () content)))) -(define-syntax-rule (schemelink id . content) - (*schemelink (quote-syntax id) 'id . content)) +(define-syntax-rule (racketlink id . content) + (*racketlink (quote-syntax id) 'id . content)) diff --git a/collects/scribble/private/manual-style.ss b/collects/scribble/private/manual-style.ss index 14ed919311..5c7087aa9c 100644 --- a/collects/scribble/private/manual-style.ss +++ b/collects/scribble/private/manual-style.ss @@ -1,4 +1,4 @@ -#lang scheme/base +#lang racket/base (require "../decode.ss" "../struct.ss" "../base.ss" @@ -7,9 +7,9 @@ (only-in "../core.ss" make-style plain) "manual-utils.ss" "on-demand.ss" - scheme/list - scheme/contract - scheme/string) + racket/list + racket/contract + racket/string) (provide (rename-out [hyperlink link]) (rename-out [other-doc other-manual]) @@ -23,12 +23,26 @@ (() () #:rest (listof pre-content?) . ->* . element?)) (define-syntax-rule (provide-styling id ...) (provide/contract [id styling-f/c] ...)) -(provide-styling schememodfont schemeoutput - schemeerror schemefont schemevalfont schemeresultfont schemeidfont schemevarfont - schemeparenfont schemekeywordfont schememetafont +(provide-styling racketmodfont racketoutput + racketerror racketfont racketvalfont racketresultfont racketidfont racketvarfont + racketparenfont racketkeywordfont racketmetafont onscreen defterm filepath exec envvar Flag DFlag PFlag DPFlag math procedure indexed-file indexed-envvar idefterm pidefterm) +(define-syntax-rule (provide-scheme-styling [rid sid] ...) + (provide/contract [rename rid sid styling-f/c] ...)) +(provide-scheme-styling [racketmodfont schememodfont] + [racketoutput schemeoutput] + [racketerror schemeerror] + [racketfont schemefont] + [racketvalfont schemevalfont] + [racketresultfont schemeresultfont] + [racketidfont schemeidfont] + [racketvarfont schemevarfont] + [racketparenfont schemeparenfont] + [racketkeywordfont schemekeywordfont] + [racketmetafont schememetafont]) + (provide void-const undefined-const) (provide/contract @@ -68,23 +82,23 @@ (define (idefterm . str) (let ([c (decode-content str)]) (make-element 'italic c))) -(define (schemefont . str) +(define (racketfont . str) (apply tt str)) -(define (schemevalfont . str) +(define (racketvalfont . str) (make-element value-color (decode-content str))) -(define (schemeresultfont . str) +(define (racketresultfont . str) (make-element result-color (decode-content str))) -(define (schemeidfont . str) +(define (racketidfont . str) (make-element symbol-color (decode-content str))) -(define (schemevarfont . str) +(define (racketvarfont . str) (make-element variable-color (decode-content str))) -(define (schemeparenfont . str) +(define (racketparenfont . str) (make-element paren-color (decode-content str))) -(define (schememetafont . str) +(define (racketmetafont . str) (make-element meta-color (decode-content str))) -(define (schememodfont . str) +(define (racketmodfont . str) (make-element module-color (decode-content str))) -(define (schemekeywordfont . str) +(define (racketkeywordfont . str) (make-element keyword-color (decode-content str))) (define (filepath . str) (make-element 'tt (append (list "\"") (decode-content str) (list "\"")))) @@ -124,9 +138,9 @@ (define (procedure . str) (make-element result-color `("#"))) -(define (schemeoutput . str) +(define (racketoutput . str) (make-element output-color (decode-content str))) -(define (schemeerror . str) +(define (racketerror . str) (make-element error-color (decode-content str))) (define (t . str) @@ -150,13 +164,13 @@ (define (hash-lang) (make-link-element module-link-color - (list (schememodfont "#lang")) + (list (racketmodfont "#lang")) `(part ,(doc-prefix '(lib "scribblings/guide/guide.scrbl") "hash-lang")))) (define-on-demand void-const - (schemeresultfont "#")) + (racketresultfont "#")) (define-on-demand undefined-const - (schemeresultfont "#")) + (racketresultfont "#")) (define (link url #:underline? [underline? #t] diff --git a/collects/scribble/scheme.ss b/collects/scribble/scheme.ss index 9e18e73634..15ba5c77b7 100644 --- a/collects/scribble/scheme.ss +++ b/collects/scribble/scheme.ss @@ -667,7 +667,8 @@ (null? s) (hash? s) (graph-defn? s) - (graph-reference? s)) + (graph-reference? s) + (struct-proxy? s)) (gen-typeset c multi-line? prefix1 prefix suffix color? qq?) (typeset-atom c (letrec ([mk diff --git a/collects/scribble/search.ss b/collects/scribble/search.ss index 796ef57582..f5187add3c 100644 --- a/collects/scribble/search.ss +++ b/collects/scribble/search.ss @@ -1,10 +1,11 @@ -(module search scheme/base +(module search racket/base (require "struct.ss" "basic.ss" setup/main-collects syntax/modcode) - (provide find-scheme-tag) + (provide find-racket-tag + (rename-out [find-racket-tag find-scheme-tag])) (define module-info-cache (make-hasheq)) @@ -21,7 +22,7 @@ (with-handlers* ([exn:fail? (lambda (exn) (fail-thunk))]) (thunk))) - (define (find-scheme-tag part ri stx/binding phase-level) + (define (find-racket-tag part ri stx/binding phase-level) ;; The phase-level argument is used only when `stx/binding' ;; is an identifier. ;; @@ -169,7 +170,7 @@ ;; have changed in inconsistent ways. So just say #f ;; for now. #; - (error 'find-scheme-tag + (error 'find-racket-tag "dead end when looking for binding source: ~e" id) (loop queue rqueue need-result?))))) diff --git a/collects/scribble/urls.ss b/collects/scribble/urls.ss index ba8f053830..c4604c2533 100644 --- a/collects/scribble/urls.ss +++ b/collects/scribble/urls.ss @@ -1,8 +1,10 @@ +#lang racket/base -(module urls mzscheme - (provide (all-defined)) +(provide (all-defined-out) + (rename-out [url:drracket url:drscheme] + [url:download-drracket url:download-drscheme])) - (define url:drscheme "http://www.drscheme.org/") - (define url:download-drscheme "http://download.plt-scheme.org/drscheme/") - - (define url:planet "http://planet.plt-scheme.org/")) +(define url:drracket "http://racket-lang.org/") +(define url:download-drracket "http://racket-lang.org/") + +(define url:planet "http://planet.plt-scheme.org/") diff --git a/collects/scribblings/foreign/foreign.scrbl b/collects/scribblings/foreign/foreign.scrbl index 52b73ab995..2e553f7967 100644 --- a/collects/scribblings/foreign/foreign.scrbl +++ b/collects/scribblings/foreign/foreign.scrbl @@ -5,10 +5,9 @@ @author["Eli Barzilay"] -@defmodule[scheme/foreign #:use-sources ('#%foreign - racket/unsafe/ffi)] +@defmodule[racket/unsafe/ffi #:use-sources ('#%foreign)] -The @schememodname[scheme/foreign] library enables the direct use of +The @schememodname[racket/unsafe/ffi] library enables the direct use of C-based APIs within Scheme programs---without writing any new C code. From the Scheme perspective, functions and data with a C-based API are @idefterm{foreign}, hence the term @defterm{foreign @@ -16,10 +15,6 @@ interface}. Furthermore, since most APIs consist mostly of functions, the foreign interface is sometimes called a @defterm{foreign function interface}, abbreviated @deftech{FFI}. -@bold{Important:} Many of the bindings documented here (the ones in -sections with titles starting ``Unsafe'') are available only after an -@scheme[(unsafe!)] declaration in the importing module. - @table-of-contents[] @include-section["intro.scrbl"] diff --git a/collects/scribblings/foreign/intro.scrbl b/collects/scribblings/foreign/intro.scrbl index b1adcfc51b..7fd62d3783 100644 --- a/collects/scribblings/foreign/intro.scrbl +++ b/collects/scribblings/foreign/intro.scrbl @@ -12,23 +12,13 @@ information in @|InsideMzScheme|, which defines how PLT Scheme interacts with C APIs in general. Since using the FFI entails many safety concerns that Scheme -programmers can normally ignore, merely importing -@schememodname[scheme/foreign] with @scheme[(require scheme/foreign)] -does not import all of the FFI functionality. Only safe functionality -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 -module that imports @schememodname[scheme/foreign] to make unsafe -features accessible. (For additional safety, the @scheme[unsafe!] is -itself protected; see @secref[#:doc '(lib -"scribblings/reference/reference.scrbl") "modprotect"].) Using this -macro should be considered as a declaration that your code is itself -unsafe, therefore can lead to serious problems in case of bugs: it is -your responsibility to provide a safe interface. Bindings that become -available only via @scheme[unsafe!] are documented in this manual in -sections with titles starting ``Unsafe.'' +programmers can normally ignore, the library name includes +@schemeidfont{unsafe}. Importing the library macro should be +considered as a declaration that your code is itself unsafe, therefore +can lead to serious problems in case of bugs: it is your +responsibility to provide a safe interface. If your library provides +an unsafe interface, then it should have @schemeidfont{unsafe} in its +name, too. For examples of common FFI usage patterns, see the defined interfaces in the @filepath{ffi} collection. diff --git a/collects/scribblings/foreign/unsafe.scrbl b/collects/scribblings/foreign/unsafe.scrbl index 416c847937..a24b3b2307 100644 --- a/collects/scribblings/foreign/unsafe.scrbl +++ b/collects/scribblings/foreign/unsafe.scrbl @@ -3,28 +3,3 @@ @title{Macros for Unsafety} -@defform[(unsafe!)]{ - -Makes most of the bindings documented in this module available. See -@secref["intro"] for information on why this declaration is required.} - - -@defform/subs[#:literals (unsafe rename-out) - (provide* provide-star-spec ...) - ([provide-star-spec (unsafe id) - (unsafe (rename-out [id external-id])) - provide-spec])]{ - -Like @scheme[provide], but @scheme[id]s under @scheme[unsafe] are not -actually provided. Instead, they are collected for introduction into -an importing module via a macro created by @scheme[define-unsafer]. - -Providing users with unsafe operations without using this facility -should be considered a bug in your code.} - -@defform[(define-unsafer id)]{ - -Cooperates with @scheme[provide*] to define @scheme[id] as a -@scheme[unsafe!]-like form that introduces definitions for each -binding provided as @scheme[unsafe]. The @scheme[define-unsafer] form -must occur after all the @scheme[provide*] forms to which it refers.} diff --git a/collects/scribblings/foreign/utils.ss b/collects/scribblings/foreign/utils.ss index 27f7732ac7..60e78cc8b5 100644 --- a/collects/scribblings/foreign/utils.ss +++ b/collects/scribblings/foreign/utils.ss @@ -1,20 +1,20 @@ -#lang scheme/base +#lang racket/base (require scribble/manual scribble/struct scribble/decode (only-in "../inside/utils.ss" cpp) - (for-syntax scheme/base) - (for-label scheme/base - scheme/contract - (except-in "unsafe-foreign.ss" ->))) + (for-syntax racket/base) + (for-label racket/base + racket/contract + (except-in racket/unsafe/ffi ->))) (provide cpp InsideMzScheme (all-from-out scribble/manual) - (for-label (all-from-out scheme/base - scheme/contract - "unsafe-foreign.ss"))) + (for-label (all-from-out racket/base + racket/contract + racket/unsafe/ffi))) (define InsideMzScheme diff --git a/collects/scribblings/gui/dynamic.scrbl b/collects/scribblings/gui/dynamic.scrbl index 3d5b77d6db..3f4eab8421 100644 --- a/collects/scribblings/gui/dynamic.scrbl +++ b/collects/scribblings/gui/dynamic.scrbl @@ -1,21 +1,21 @@ #lang scribble/doc @(require "common.ss" - (for-label scheme/gui/dynamic)) + (for-label racket/gui/dynamic)) @title{Dynamic Loading} -@defmodule[scheme/gui/dynamic]{The @schememodname[scheme/gui/dynamic] -library provides functions for dynamically accessing the PLT Scheme -GUI toolbox, instead of directly requiring @scheme[scheme/gui] or -@scheme[scheme/gui/base].} +@defmodule[racket/gui/dynamic]{The @racketmodname[racket/gui/dynamic] +library provides functions for dynamically accessing the PLT Racket +GUI toolbox, instead of directly requiring @racket[racket/gui] or +@racket[racket/gui/base].} @defproc[(gui-available?) boolean?]{ -Returns @scheme[#t] if dynamic access to the GUI bindings are +Returns @racket[#t] if dynamic access to the GUI bindings are available---that is, that the program is being run as a @exec{mred}-based application, as opposed to a pure -@exec{mzscheme}-based application, and that GUI modules are attached -to the namespace in which @scheme[scheme/gui/dynamic] was +@exec{mzracket}-based application, and that GUI modules are attached +to the namespace in which @racket[racket/gui/dynamic] was instantiated. This predicate can be used in code that optionally uses GUI elements @@ -24,5 +24,5 @@ when they are available.} @defproc[(gui-dynamic-require [sym symbol?]) any]{ -Like @scheme[dynamic-require], but specifically to access exports of -@scheme[scheme/gui/base].} +Like @racket[dynamic-require], but specifically to access exports of +@racket[racket/gui/base].} diff --git a/collects/scribblings/gui/gui.scrbl b/collects/scribblings/gui/gui.scrbl index 06abcca664..30d2b000c0 100644 --- a/collects/scribblings/gui/gui.scrbl +++ b/collects/scribblings/gui/gui.scrbl @@ -5,21 +5,21 @@ @author["Matthew Flatt" "Robert Bruce Findler" "John Clements"] -@declare-exporting[scheme/gui/base scheme/gui #:use-sources (mred)] +@declare-exporting[racket/gui/base racket/gui #:use-sources (mred)] This reference manual describes the GUI toolbox that is part of PLT - Scheme and whose core is implemented by the MrEd executable. + Racket and whose core is implemented by the MrEd executable. -@defmodule*/no-declare[(scheme/gui/base)]{The -@schememodname[scheme/gui/base] library provides all of the class, +@defmodule*/no-declare[(racket/gui/base)]{The +@racketmodname[racket/gui/base] library provides all of the class, interface, and procedure bindings defined in this manual. At run time, this library needs primitive graphics support that the MrEd executable -provides; this library cannot run in MzScheme.} +provides; this library cannot run in MzRacket.} -@defmodulelang*/no-declare[(scheme/gui)]{The -@schememodname[scheme/gui] language combines all bindings of the -@schememodname[scheme] language and the -@schememodname[scheme/gui/base] modules.} +@defmodulelang*/no-declare[(racket/gui)]{The +@racketmodname[racket/gui] language combines all bindings of the +@racketmodname[racket] language and the +@racketmodname[racket/gui/base] modules.} @table-of-contents[] diff --git a/collects/scribblings/quick/images/exprs.dat b/collects/scribblings/quick/images/exprs.dat index e07575e6c7..cb78daca61 100644 --- a/collects/scribblings/quick/images/exprs.dat +++ b/collects/scribblings/quick/images/exprs.dat @@ -3,88 +3,88 @@ ((2) 0 () 0 () () (c begin c "art gallery")) ((2) 0 () 0 () () "art gallery") ((2) 0 () 0 () () (c circle c 10)) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img0") (c ".pdf" c ".png") 1.0)) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img0") (c ".pdf" c ".png") 1.0)) ((2) 0 () 0 () () (c rectangle c 10 c 20)) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img1") (c ".pdf" c ".png") 1.0)) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img1") (c ".pdf" c ".png") 1.0)) ((2) 0 () 0 () () (c circle c 10 c 20)) -((2) 1 (((lib "scriblib/private/gui-eval-exn.ss") . deserialize-info:gui-exn-v0)) 0 () () (0 "procedure circle: expects 1 argument, given 2: 10 20")) +((2) 1 (((lib "scriblib/private/gui-eval-exn.rkt") . deserialize-info:gui-exn-v0)) 0 () () (0 "procedure circle: expects 1 argument, given 2: 10 20")) ((2) 0 () 0 () () (c hc-append c (c circle c 10) c (c rectangle c 10 c 20))) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img2") (c ".pdf" c ".png") 1.0)) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img2") (c ".pdf" c ".png") 1.0)) ((2) 0 () 0 () () (c define c c c (c circle c 10))) ((2) 0 () 0 () () (void)) ((2) 0 () 0 () () (c define c r c (c rectangle c 10 c 20))) ((2) 0 () 0 () () (void)) ((2) 0 () 0 () () r) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img3") (c ".pdf" c ".png") 1.0)) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img3") (c ".pdf" c ".png") 1.0)) ((2) 0 () 0 () () (c hc-append c c c r)) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img4") (c ".pdf" c ".png") 1.0)) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img4") (c ".pdf" c ".png") 1.0)) ((2) 0 () 0 () () (c hc-append c 20 c c c r c c)) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img5") (c ".pdf" c ".png") 1.0)) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img5") (c ".pdf" c ".png") 1.0)) ((2) 0 () 0 () () (c define c (c square c n) c (c filled-rectangle c n c n))) ((2) 0 () 0 () () (void)) ((2) 0 () 0 () () (c square c 10)) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img6") (c ".pdf" c ".png") 1.0)) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img6") (c ".pdf" c ".png") 1.0)) ((2) 0 () 0 () () (c define c (c four c p) c (c define c two-p c (c hc-append c p c p)) c (c vc-append c two-p c two-p))) ((2) 0 () 0 () () (void)) ((2) 0 () 0 () () (c four c (c circle c 10))) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img7") (c ".pdf" c ".png") 1.0)) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img7") (c ".pdf" c ".png") 1.0)) ((2) 0 () 0 () () (c define c (c checker c p1 c p2) c (c let c (c (c p12 c (c hc-append c p1 c p2)) c (c p21 c (c hc-append c p2 c p1))) c (c vc-append c p12 c p21)))) ((2) 0 () 0 () () (void)) ((2) 0 () 0 () () (c checker c (c colorize c (c square c 10) c "red") c (c colorize c (c square c 10) c "black"))) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img8") (c ".pdf" c ".png") 1.0)) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img8") (c ".pdf" c ".png") 1.0)) ((2) 0 () 0 () () (c define c (c checkerboard c p) c (c let* c (c (c rp c (c colorize c p c "red")) c (c bp c (c colorize c p c "black")) c (c c c (c checker c rp c bp)) c (c c4 c (c four c c))) c (c four c c4)))) ((2) 0 () 0 () () (void)) ((2) 0 () 0 () () (c checkerboard c (c square c 10))) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img9") (c ".pdf" c ".png") 1.0)) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img9") (c ".pdf" c ".png") 1.0)) ((2) 0 () 0 () () circle) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:element-v0)) 0 () () (0 #f (c (u . "#")))) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:element-v0)) 0 () () (0 #f (c (u . "#")))) ((2) 0 () 0 () () (c define c (c series c mk) c (c hc-append c 4 c (c mk c 5) c (c mk c 10) c (c mk c 20)))) ((2) 0 () 0 () () (void)) ((2) 0 () 0 () () (c series c circle)) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img10") (c ".pdf" c ".png") 1.0)) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img10") (c ".pdf" c ".png") 1.0)) ((2) 0 () 0 () () (c series c square)) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img11") (c ".pdf" c ".png") 1.0)) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img11") (c ".pdf" c ".png") 1.0)) ((2) 0 () 0 () () (c series c (c lambda c (c size) c (c checkerboard c (c square c size))))) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img12") (c ".pdf" c ".png") 1.0)) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img12") (c ".pdf" c ".png") 1.0)) ((2) 0 () 0 () () (c define c (c rgb-series c mk) c (c vc-append c (c series c (c lambda c (c sz) c (c colorize c (c mk c sz) c "red"))) c (c series c (c lambda c (c sz) c (c colorize c (c mk c sz) c "green"))) c (c series c (c lambda c (c sz) c (c colorize c (c mk c sz) c "blue")))))) ((2) 0 () 0 () () (void)) ((2) 0 () 0 () () (c rgb-series c circle)) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img13") (c ".pdf" c ".png") 1.0)) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img13") (c ".pdf" c ".png") 1.0)) ((2) 0 () 0 () () (c rgb-series c square)) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img14") (c ".pdf" c ".png") 1.0)) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img14") (c ".pdf" c ".png") 1.0)) ((2) 0 () 0 () () (c define c (c rgb-maker c mk) c (c lambda c (c sz) c (c vc-append c (c colorize c (c mk c sz) c "red") c (c colorize c (c mk c sz) c "green") c (c colorize c (c mk c sz) c "blue"))))) ((2) 0 () 0 () () (void)) ((2) 0 () 0 () () (c series c (c rgb-maker c circle))) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img15") (c ".pdf" c ".png") 1.0)) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img15") (c ".pdf" c ".png") 1.0)) ((2) 0 () 0 () () (c series c (c rgb-maker c square))) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img16") (c ".pdf" c ".png") 1.0)) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img16") (c ".pdf" c ".png") 1.0)) ((2) 0 () 0 () () (c list c "red" c "green" c "blue")) ((2) 0 () 0 () () (c "red" c "green" c "blue")) ((2) 0 () 0 () () (c list c (c circle c 10) c (c square c 10))) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:image-element-v0)) 2 ("[image]" (c ".pdf" c ".png")) () (c (0 #f (c (? . 0)) (u . "images/img17") (? . 1) 1.0) c (0 #f (c (? . 0)) (u . "images/img18") (? . 1) 1.0))) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:image-element-v0)) 2 ("[image]" (c ".pdf" c ".png")) () (c (0 #f (c (? . 0)) (u . "images/img17") (? . 1) 1.0) c (0 #f (c (? . 0)) (u . "images/img18") (? . 1) 1.0))) ((2) 0 () 0 () () (c define c (c rainbow c p) c (c map c (c lambda c (c color) c (c colorize c p c color)) c (c list c "red" c "orange" c "yellow" c "green" c "blue" c "purple")))) ((2) 0 () 0 () () (void)) ((2) 0 () 0 () () (c rainbow c (c square c 5))) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:image-element-v0)) 2 ("[image]" (c ".pdf" c ".png")) () (c (0 #f (c (? . 0)) (u . "images/img19") (? . 1) 1.0) c (0 #f (c (? . 0)) (u . "images/img20") (? . 1) 1.0) c (0 #f (c (? . 0)) (u . "images/img21") (? . 1) 1.0) c (0 #f (c (? . 0)) (u . "images/img22") (? . 1) 1.0) c (0 #f (c (? . 0)) (u . "images/img23") (? . 1) 1.0) c (0 #f (c (? . 0)) (u . "images/img24") (? . 1) 1.0))) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:image-element-v0)) 2 ("[image]" (c ".pdf" c ".png")) () (c (0 #f (c (? . 0)) (u . "images/img19") (? . 1) 1.0) c (0 #f (c (? . 0)) (u . "images/img20") (? . 1) 1.0) c (0 #f (c (? . 0)) (u . "images/img21") (? . 1) 1.0) c (0 #f (c (? . 0)) (u . "images/img22") (? . 1) 1.0) c (0 #f (c (? . 0)) (u . "images/img23") (? . 1) 1.0) c (0 #f (c (? . 0)) (u . "images/img24") (? . 1) 1.0))) ((2) 0 () 0 () () (c apply c vc-append c (c rainbow c (c square c 5)))) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img25") (c ".pdf" c ".png") 1.0)) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img25") (c ".pdf" c ".png") 1.0)) ((2) 0 () 0 () () (c require c slideshow/flash)) ((2) 0 () 0 () () (void)) ((2) 0 () 0 () () (c filled-flash c 40 c 30)) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img26") (c ".pdf" c ".png") 1.0)) -((2) 0 () 0 () () (c require c (c planet c "random.ss" c (c "schematics" c "random.plt" c 1 c 0)))) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img26") (c ".pdf" c ".png") 1.0)) +((2) 0 () 0 () () (c require c (c planet c "random.rkt" c (c "schematics" c "random.plt" c 1 c 0)))) ((2) 0 () 0 () () (void)) ((2) 0 () 0 () () (c random-gaussian)) ((2) 0 () 0 () () 0.7386912134436788) ((2) 0 () 0 () () (c require c slideshow/code)) ((2) 0 () 0 () () (void)) ((2) 0 () 0 () () (c code c (c circle c 10))) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img27") (c ".pdf" c ".png") 1.0)) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img27") (c ".pdf" c ".png") 1.0)) ((2) 0 () 0 () () (c define-syntax c pict+code c (c syntax-rules c () c (c (c pict+code c expr) c (c hc-append c 10 c expr c (c code c expr)))))) ((2) 0 () 0 () () (void)) ((2) 0 () 0 () () (c pict+code c (c circle c 10))) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img28") (c ".pdf" c ".png") 1.0)) -((2) 0 () 0 () () (c require c scheme/class c scheme/gui/base)) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img28") (c ".pdf" c ".png") 1.0)) +((2) 0 () 0 () () (c require c racket/class c racket/gui/base)) ((2) 0 () 0 () () (void)) ((2) 0 () 0 () () (c define c f c (c new c frame% c (c label c "My Art") c (c width c 300) c (c height c 300) c (c alignment c (c quote c (c center c center)))))) ((2) 0 () 0 () () (void)) @@ -95,8 +95,8 @@ ((2) 0 () 0 () () (c define c (c add-drawing c p) c (c let c (c (c drawer c (c make-pict-drawer c p))) c (c new c canvas% c (c parent c f) c (c style c (c quote c (c border))) c (c paint-callback c (c lambda c (c self c dc) c (c drawer c dc c 0 c 0))))))) ((2) 0 () 0 () () (void)) ((2) 0 () 0 () () (c add-drawing c (c pict+code c (c circle c 10)))) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:element-v0)) 0 () () (0 #f (c (u . "#(struct:object:canvas% ...)")))) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:element-v0)) 0 () () (0 #f (c (u . "#(struct:object:canvas% ...)")))) ((2) 0 () 0 () () (c add-drawing c (c colorize c (c filled-flash c 50 c 30) c "yellow"))) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:element-v0)) 0 () () (0 #f (c (u . "#(struct:object:canvas% ...)")))) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:element-v0)) 0 () () (0 #f (c (u . "#(struct:object:canvas% ...)")))) ((2) 0 () 0 () () (c scale c (c bitmap c (c build-path c (c collection-path c "scribblings/quick") c "art.png")) c 0.5)) -((2) 1 (((lib "scribble/core.ss") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img29") (c ".pdf" c ".png") 1.0)) +((2) 1 (((lib "scribble/core.rkt") . deserialize-info:image-element-v0)) 0 () () (0 #f (c "[image]") (u . "images/img29") (c ".pdf" c ".png") 1.0)) diff --git a/collects/scribblings/quick/images/img0.pdf b/collects/scribblings/quick/images/img0.pdf index fdf8c77dfe776478c65ae71bfa2febca76e21f76..25438957a6c3f594c53545fc720602456fdefd2a 100644 GIT binary patch delta 302 zcmca1d_#Cc6|<0Kl8J$dL1K!og_)VDuAyOS;$%5ismaTjQ?X0QPPSq(5;Qc>H89aN zG72#?wlX!fGBuuD%OZtEbOlQac4I=Y3AeBsVG{H89aN zG72#?wlX!fGBuv;&mx6Iw2CDKyD=fygu_^kun7a*vv~`vD3hL{fq{vUk)g4vsj0E9 zftk92fx0G_zHfetOJYf?hKrSv0kVqC-`T?$ot&M_%`MDbom~wKEi8?l&CLxA+>Bk^ VfP7a=OCtkgI~zhOCiinn0|2@GOMd_W delta 302 zcmZ1_yh?b353^93L0VF(r9ql*Vw!Q1uAyP7<>U`6Qj;r~Q?X0QPUc}T5;U;XH89sT zG72%Yure~WGPRiO&mx6Iw2CDKyD=fygu_^kun7a*vv~`vD3hLnrGdGTk)ef=si}po zftk92fx0G_zHfetOJYf?hKrSv0kVqC-`T?$oh)2Toy{Cw4P6XPolTt_EsY%AEQ}3| W+)UjJ%uGxSo$YK0shHf)DGdM?T2Gh& diff --git a/collects/scribblings/quick/images/img10.pdf b/collects/scribblings/quick/images/img10.pdf index 934fe974d6..5d70606044 100644 --- a/collects/scribblings/quick/images/img10.pdf +++ b/collects/scribblings/quick/images/img10.pdf @@ -42,10 +42,10 @@ endobj - -PLT Scheme - -Untitledmflatt@Macintosh \(Matthew Flatt\) + +PLT Scheme + +Untitledmflatt@Macintosh \(Matthew Flatt\) @@ -55,8 +55,8 @@ endstream endobj 2 0 obj <>endobj xref @@ -73,7 +73,7 @@ xref 0000000640 00000 n trailer << /Size 10 /Root 1 0 R /Info 2 0 R -/ID [<359940CD83EE8F3FC014C34CE1255CDE><359940CD83EE8F3FC014C34CE1255CDE>] +/ID [<773F739C40C01D398B1ACA4FA8323A87><773F739C40C01D398B1ACA4FA8323A87>] >> startxref 2278 diff --git a/collects/scribblings/quick/images/img11.pdf b/collects/scribblings/quick/images/img11.pdf index b71cc76089009d472bb68c13a78fd1f0052d39d7..bbf27fdc69effedc1fb8aca4189128241d60f296 100644 GIT binary patch delta 305 zcmX>td|G%zF0+tjQi?^2xlxL)g_)VDuAyOS;$%TqsmU{$Q?X0QPS#~H5;Qc>H89aN zG72#?wlX!fGBuf8z#@f3bT&&0c4I=Y3ky%~VwJ}(CAIk~t0td|G%zF0)XYQL<@bvPGJ1Vw!Q1uAyP7ub6jS_OLig4WOGBal*ANW3o|oQT|>jv#L2y!Qjl zWE5g(Y-MT+M3dieNMR8b=S;zFOb9mN&zwfsgn{na9LOcgq-SVgU}9usXlx1ux&~(I z1_tVyT>8HGDK3d6sTwX;Mh3_#Hc#ORV{~*gb~ZFHw6rvHb~P|`Gc&SuaWZi+GBtCu TFf+F_H*>YKA)sQiHlGXt%YsX| delta 301 zcmX>ub6jS_OLn0&qh!;>WQ#Q2#5Ch1T|>iE%gMc*Qjjv#L3rL>ahuDvdK-XEVYgyjhrC zpNYrNz`(@F$k5mn2qyb+ilGQ>F5nDfjCHnfGBk0sG<7yHHnK2tcCs+CFmSdob8)dW oF>*C9H?p%Ks3Mlj&W@|NB(bQZq9`?u%gDsif=gA^)!&T^0FDV!x&QzG delta 321 zcmZ21wpeV#Q5K;zqh!;>WQ#Q2#5Ch1T|>iE%gNVS>ahuDvdKkGi3L{9MX8A;sV+clt8Qd~p>* - -PLT Scheme - -Untitledmflatt@Macintosh \(Matthew Flatt\) + +PLT Scheme + +Untitledmflatt@Macintosh \(Matthew Flatt\) @@ -55,8 +55,8 @@ endstream endobj 2 0 obj <>endobj xref @@ -73,7 +73,7 @@ xref 0000000577 00000 n trailer << /Size 10 /Root 1 0 R /Info 2 0 R -/ID [] +/ID [] >> startxref 2215 diff --git a/collects/scribblings/quick/images/img15.pdf b/collects/scribblings/quick/images/img15.pdf index 4375287b58cb323c0b164996b88b5a0ab8ec32cb..b84d3dd08b07a1bd8b77f4ad3fc0be29afe7b6a7 100644 GIT binary patch delta 305 zcmbO&Hd}1NUKSzCWOGBal*ANW3o|oQT|>jv#L0l zWE5g(Y-MT+M3WD&N?{Rw&6IMetnq2z6`6(`mC8-)NRz?QMDmG_uhA}!BI9j+^8XKBfx>;BnS~wdTIyo5`xELF{ TS-6;6x)>SS*$`4OiCY=~u4_ys delta 305 zcmbO&Hd}1NUKXJ=qh!;>WQ#Q2#5Ch1T|>iE%gKpsQj=e@q+*wnom|UmBxqo%YhbQx zWE5g(VP#}yWneh@0IL)h(budg*o_InE-XCx7MnbFDXGn>?4nG129^fqMn;AfMrH8HGDK3d6sTwX;Mh3_#HfL~#F*+HVJ6SrpTAG - -PLT Scheme - -Untitledmflatt@Macintosh \(Matthew Flatt\) + +PLT Scheme + +Untitledmflatt@Macintosh \(Matthew Flatt\) @@ -55,8 +55,8 @@ endstream endobj 2 0 obj <>endobj xref @@ -73,7 +73,7 @@ xref 0000000588 00000 n trailer << /Size 10 /Root 1 0 R /Info 2 0 R -/ID [<3F728FBF71FC3EE42151B158C78C6E47><3F728FBF71FC3EE42151B158C78C6E47>] +/ID [<2D22C5E6138860AE600CF56ED7C7E964><2D22C5E6138860AE600CF56ED7C7E964>] >> startxref 2226 diff --git a/collects/scribblings/quick/images/img17.pdf b/collects/scribblings/quick/images/img17.pdf index 92fd33a72a5da2c55cfffbf5d5cc0d737679bf42..423035879bb2119824758c99f2b40b734a6e9c18 100644 GIT binary patch delta 302 zcmca1d_#Cc6|<0KvbmvIN@9wxg_)VDuAyOS;$%5ismaTjQ?X0QPPSq(5;Qc>H89aN zG72#?wlXyZqRF)^QdmS+u%uu&CIp*s3#$<}VW4|9KVlVS(lazLFflSRG&ThST>~?9 z0|RwUE`8tp6qm%3R1Fs^BLid=n^if&7@gc4&72%vEzAwf9W5M<3`{LtP2CI(&5R9A T+)PXyUCixl2&tI7ms1)5NHR)C delta 302 zcmca1d_#Cc6|+#9v1zJ_u|b+{Vw!Q1uAyP7wboh%$J%}gDQ%?wQqoLwC) Wj4Vu?oQzz}EbVLvshGT%QyKsT=1Xe; diff --git a/collects/scribblings/quick/images/img18.pdf b/collects/scribblings/quick/images/img18.pdf index c017abb110ff64ad5370ed13ad294f0336d845fa..766c59b57ad9892efff7a5ef5e5f088cbe19e4f6 100644 GIT binary patch delta 302 zcmZ1_yh?b353`VEib0}*iBXEKg_)VDuAyOS;^Yr3Qj;r~Q?X0QPUc}T5;Qc>H89aN zG72#?wlX!fGBum*&mx6Iw2CDKyD=fygu_^kun7a*vv~`vD3hL{0nnvJhQ_9*re?YZ zX6gn8>Y7~ozWFIGi6yBTE>=bc$SO8}XAfg^ayE1{H?}Zwax!&xbu=_IbaXT|vNUqG VbTctDw=^|#w6h_kVsbyHGyuG;OJM*2 delta 302 zcmZ1_yh?b353^93v1zJ_u|b+{Vw!Q1uAyP7<>U`6Qj;r~Q?X0QPUc}T5;U;XH89sT zG72%Yure~UGBBF#&mx6Iw2CDKyD=fygu_^kun7a*vv~`vD3hLnrGdGTk)ef=nSqh6 zftk92fx0G_zHfetOJYf?hKrSv0kVqC-`T?$o!ks9fEpalTntQ2Obncjo!l(UO^jUK VjNDwzjEtRK>}&|BnB31P4FFr*O>zJL diff --git a/collects/scribblings/quick/images/img19.pdf b/collects/scribblings/quick/images/img19.pdf index 45b4b91d19a5282eef990ab93bd78187f8e2340a..b8e14fbdc00c81e73570d9a1d334deb7e11b5957 100644 GIT binary patch delta 302 zcmZ1}yi$0BH?xpsib0}*iBXEKg_)VDuAyOS;^g-%Qj^P>Q?X0QPUdDY5;Qc>H89aN zG72#?wlX!fGBum*$0CJAw2~zSyD=fyghN@4un7a*vw1VCD3hL{0nnvJhQ_9*re?YZ zX6gn8>Y7~ozWFIGi6yBTE>=bc$SO8}V-I6=GIFypwJ^3curzmau`o3@H+C{JbTTtH VcXP2cadtB|v9lqhVsam+GytmFOG*F$ delta 302 zcmZ1}yi$0BH?vThv1zJ_u|b+{Vw!Q1uAyP7<>dD)Qj^P>Q?X0QPUdDY5;U;XH89sT zG72%Yure~UGBBF#$0CJAw2~zSyD=fyghN@4un7a*vw1VCD3hLnrGdGTk)ef=nSqh6 zftk92fx0G_zHfetOJYf?hKrSv0kVqC-`K+#os69fT%3)}oQ+&vOw27!EsV@fog59E W&5T^lOpF{|9qnugshHfyDGdNs*iCf+ diff --git a/collects/scribblings/quick/images/img2.pdf b/collects/scribblings/quick/images/img2.pdf index 2f95dc5f10..94573b751b 100644 --- a/collects/scribblings/quick/images/img2.pdf +++ b/collects/scribblings/quick/images/img2.pdf @@ -44,10 +44,10 @@ endobj - -PLT Scheme - -Untitledmflatt@Macintosh \(Matthew Flatt\) + +PLT Scheme + +Untitledmflatt@Macintosh \(Matthew Flatt\) @@ -57,8 +57,8 @@ endstream endobj 2 0 obj <>endobj xref @@ -75,7 +75,7 @@ xref 0000000546 00000 n trailer << /Size 10 /Root 1 0 R /Info 2 0 R -/ID [] +/ID [<0A1E7255A8DE9CB04AA60879F660024B><0A1E7255A8DE9CB04AA60879F660024B>] >> startxref 2184 diff --git a/collects/scribblings/quick/images/img20.pdf b/collects/scribblings/quick/images/img20.pdf index 7377683ff33744bf2e20c7c27ce55dba04090216..c26e315d452498bccfc4009882751419d9ce47d0 100644 GIT binary patch delta 338 zcmdlayh(UN2(yr7ib0}*iBXEKg_)VDuAyOS;^Z{udThc!SY#)Quo&4G8t59B=o%S? z7#drdnp&Bf=^B_>85pQ5R3sKyITxiSmZZ7>v8}q10fy4aO)M$c%?`mP9LH*eMR@Zf zR(&QtLj$0*jSP)VO~Ecu2f9F$OW!v?1!TE~ixtRrgo@4o*~1uP%`FWKEu38}jGYXO z91YAIEuEd*T#OwZ9bKG_4V(?#>}&|Ch~=`g<0>vmEGnreN=@T3GBmQ}QdM>JcjE#8 DxARqZ delta 338 zcmdlayh(UN2(wU{ahh3*rA3-WNxdThc!SY#)Quo&4GSn3*>>lzt_ z7+P2vnOPYa>ly$_19gRp!~!elqSVBaR2Lw&RW~xgP&&DZB?Y_LA=rfDSdFjsetU$ISRBZmw9>y4JVrpt(X>R81>S$qM z>E>kO=wxExXk>2YXz6TbZ0=}oXG2g$ESH@fS8+*VQAtHnY8sc3p^+t*s;aBM8y5hw CSXg)f diff --git a/collects/scribblings/quick/images/img21.pdf b/collects/scribblings/quick/images/img21.pdf index 0d081d40bcceb6bb51db266d4b3716a4f6f8d64d..0a66ba9f0d383c97f334d1278f27526440481758 100644 GIT binary patch delta 305 zcmZ22yjpmJFSC$kib0}*iBXEKg_)VDuAyOS;^dDkQj;s0Q?X0QPUdAX5;Qc>H89aN zG72#?wlX!fGBukVz#@f3w3;OayD=fyg@q?)vC3nYlG?nLRg_83&;aOKBST|TQ&Tft z12c6419eRZenQj;s0Q?X0QPUdAX5;U;XH89sT zG72%Yure~UGBBPTz#@f3w3;OayD=fyg@q?)vC3nYlG?nLRg_83z|z3n$jH#b$jrc4 z*T78Oz(8G-OW!v?#U-&MRl~)~$N*Wz<{#|gjE>GOMn)!Prsig*&K9ng76z`yPKGXy Xu9l9LuC4}77Irq41XN6(z$py?&a+T& diff --git a/collects/scribblings/quick/images/img22.pdf b/collects/scribblings/quick/images/img22.pdf index 5b6ef6524b95024af090ca0a66ad539e0c3d5dae..93e545155f8524ee0f732926dfe186989f719531 100644 GIT binary patch delta 306 zcmZ1@yheC~AG45Uib0}*iBXEKg_)VDuAyOS;^dFaQj@EgQ?X0=3mO{e8kp!B8HE@c zTbY_#nVL-wWRb!mTEmip-3Zyq{H*5KrGzJEv&v(alG?nDRg_83&;aOKBST|TQ&Tft z12c6419eRZgdQj@EgQ?X0=3mRDJ8kp-E8HE^H zSQ(jF85mCvWRb!mTEmip-3Zyq{H*5KrGzJEv&v(alG?nDRg_83z|z3n$jH#b$jrc4 z*T78Oz(8G-OW!v?#U-&MRl~)~$N*Wz=AZ0gj82XwrsjsuZsu-|rY5FthK_C)CZ-ln XP8Q}SE|w-PrfzmNgj7tP$SDl~Ku%D$ diff --git a/collects/scribblings/quick/images/img23.pdf b/collects/scribblings/quick/images/img23.pdf index 1308619bbe78433706b0589a3faecc0f7368cfa4..5abb060e1aac5aebd294eaa66254b8cbead26fd8 100644 GIT binary patch delta 306 zcmZ22yjpmJFSC$kib0}*iBXEKg_)VDuAyOS;^dDkQj;s0Q?X0QPUdAX5;Qc>H89aN zG72#?wlX!fGBukVz#@f3w3;OayD=fyg@q?)vC3nYlG?nLRg_83&;aOKBST|TQ&Tft z12c6419eR8W>nu7#O%Xx>>k68XB29 Wx*EBdI6AvJI@#F}QZab~r!)X#1x;lD delta 306 zcmZ22yjpmJFSAgZahh3*rA3-ZenQj;s0Q?X0QPUdAX5;U;XH89sT zG72%Yure~UGBBPTz#@f3w3;OayD=fyg@q?)vC3nYlG?nLRg_83z|z3n$jH#b$jrc4 z*T78Oz(8G-OW!v?#U-&MRl~)~$N*Wz<{#`~j7}EjZjQ#rMotzcj;_w;2ChctZqAO5 X7DmQy7UoXI29|aod{B5pGP96nib0}*iBXEKg_)VDuAyOS;^d92Qj`0cQ*lWtu$bBy8t59B=o%S? z7#drdnp&Bf=^B_>85pQ5R3sKyITxiSmZZ7>v8}q10fy4a6IoJlnXSlbguhFVY2sw) zYGG+od{B5pGP6*cahh3*rA3-Za5Qj`0cQ*lWtu$bBySn3*>>lzt_ z7+P2vnOPYa>ly$_19gRp!~!elqSVBaR2Lw&RW~xgP&#=cOA0Qt6HFrVfE=OWVg+&qLd9l2jxfepOQ2deCksnc z7js7oGXrO56DL - -PLT Scheme - -Untitledmflatt@Macintosh \(Matthew Flatt\) + +PLT Scheme + +Untitledmflatt@Macintosh \(Matthew Flatt\) @@ -56,8 +56,8 @@ endstream endobj 2 0 obj <>endobj xref @@ -74,7 +74,7 @@ xref 0000000577 00000 n trailer << /Size 10 /Root 1 0 R /Info 2 0 R -/ID [] +/ID [] >> startxref 2215 diff --git a/collects/scribblings/quick/images/img26.pdf b/collects/scribblings/quick/images/img26.pdf index d3f53f6e63..d979ba6be1 100644 --- a/collects/scribblings/quick/images/img26.pdf +++ b/collects/scribblings/quick/images/img26.pdf @@ -42,10 +42,10 @@ endobj - -PLT Scheme - -Untitledmflatt@Macintosh \(Matthew Flatt\) + +PLT Scheme + +Untitledmflatt@Macintosh \(Matthew Flatt\) @@ -55,8 +55,8 @@ endstream endobj 2 0 obj <>endobj xref @@ -73,7 +73,7 @@ xref 0000000622 00000 n trailer << /Size 10 /Root 1 0 R /Info 2 0 R -/ID [<5B1279F9960652F0F9499AE6C2394568><5B1279F9960652F0F9499AE6C2394568>] +/ID [<6C51B73DC3A90C9A3E8D707F4552676C><6C51B73DC3A90C9A3E8D707F4552676C>] >> startxref 2260 diff --git a/collects/scribblings/quick/images/img27.pdf b/collects/scribblings/quick/images/img27.pdf index 885aa953ec4fde0d15db1e576a8981089e3533fe..4c0667c991e6b969465d7b9b8d441a6d78bc818e 100644 GIT binary patch delta 302 zcmdn4yj^(%C%2GgN}`cvVq%J}g_)VDuAyOS;^ehFQj<-&Q?X0QPCm(PBxq=$Yha>l zWE5g(Y-MU{WokZ|heryFs5wsxc4I=Y2@CTYVG{WA9xENU&xw#p+ W7&%%RI~h7z7}?nnQZadspfmuPq)e&+ delta 302 zcmdn4yj^(%C$~_ViA9>ZfkB#XVw!Q1uAyP7<>a+IQj<-&Q?X0QPCm(PBxqo%YhbQx zWE5g(VP#}yWneOyheryFs5wsxc4I=Y2@CTYVG{F3bIvP1SJGnTy8aNx7IyxE| WnLAsWnHifHINI3|QZadspfmuG>r6KQ diff --git a/collects/scribblings/quick/images/img28.pdf b/collects/scribblings/quick/images/img28.pdf index f11402b45ed156c893b5bce3ea5d89ef832507ea..63cf5f2e8f715e381ef1f3844e5dce8bbd0ea2fe 100644 GIT binary patch delta 302 zcmeya{9Sp2C%2Ggs&SIBp;3yig_)VDuAyOS;^enHQj<%$Q?X0QPUhq>5;Qc>H89aN zG72#?wlX!fGPRiO!y|=7w45geyD=fygoAmFun7a*vw0)0D3hL{fq{vUk)g4vsi}po zftk92fx0G_zHfetOJYf?hKrSv0kVqCU-*|XI=Q;JnVJ|IIyxCzxEWfSIhi_Hn3x$E Wxi}jcxVjpcIosI~QZf0Cpfmveu1!S% delta 302 zcmeya{9Sp2C$~_ViA9>ZfkB#XVw!Q1uAyP7<>a?KQj<%$Q?X0QPUhq>5;U;XH89sT zG72%Yure~UGBBC!!y|=7w45geyD=fygoAmFun7a*vw0)0D3hLnrGdGTk)ef=nSqI} zftk92fx0G_zHfetOJYf?hKrSv0kVqCU-*|XI+5SehBTT38slxwx8I7#O%Y Wx;Pt|x|mv8n%mhBQZf0CpfmuWZckPK diff --git a/collects/scribblings/quick/images/img29.pdf b/collects/scribblings/quick/images/img29.pdf index 4c132036eb830c946d3b9a73c75e33ab7e91b4dc..709afd4a14a3c3f348340890a37e004af618a125 100644 GIT binary patch delta 298 zcmZ3Jv?gi8QY|6NRO2LLL!%U33o|oQT|>jv#L3&W>ahuX>c~z`)i$y*G|)9L(KRv( zF*LR^HMKIe&^0i#GB8kAs7NfZaxO|uEJ<|%Vq0}10}Q2;FKee@H#-EI@Om91EW(>V z>*zD_7#bLu7#SHFo0^(hOxDvELlM{0WMEiE%gNid>ahuX>c~z`)i$y*u+%j$*EKQ< zF|@EUGP5!;)inT;2I>kGi3L{9MX8A;sV+clt8Qd~p>*lmFJo!yL#4V)}pTnx>P4BSjzT}>TbE!>Qp UOf8Mv%$$wwYzV2CEMO=D0Qr4RBme*a diff --git a/collects/scribblings/quick/images/img3.pdf b/collects/scribblings/quick/images/img3.pdf index 42c8531d155599f0e5ad6ff9635c9ea2d626ff54..d0d2fbb1781f8be9b8ee11daae68905f27a91612 100644 GIT binary patch delta 302 zcmZ1_yh?b353`VEl8J$dL1K!og_)VDuAyOS;^Yr3Qj;r~Q?X0QPUc}T5;Qc>H89aN zG72#?wlX!fGBuv;&mx6Iw2CDKyD=fygu_^kun7a*vv~`vD3hL{fq{vUk)g4vsj0E9 zftk92fx0G_zHfetOJYf?hKrSv0kVqC-`T?$oeUh^%w0^4jg6cQ&D;#lER7w_4Gc^z W42|3@TujXkP3>$5shHf)DGdOk$x7n@ delta 302 zcmZ1_yh?b353^93p{0p=nnjv!Vw!Q1uAyP7<>U`6Qj;r~Q?X0QPUc}T5;U;XH89sT zG72%Yure~WGPRuS&mx6Iw2CDKyD=fygu_^kun7a*vv~`vD3hLnrGdGTk)ef=sVUHY zGj#(4bxkgP-~1Gp#FA7E7b_zJWEGpgvxhM{nYtMo8yT6HIvTqexHuYHI+_?6n7O(+ VnY)==7&uut+Sw3NF}a^p8UU}hP1yhd diff --git a/collects/scribblings/quick/images/img4.pdf b/collects/scribblings/quick/images/img4.pdf index f00b183fa2..b97703e6c6 100644 --- a/collects/scribblings/quick/images/img4.pdf +++ b/collects/scribblings/quick/images/img4.pdf @@ -44,10 +44,10 @@ endobj - -PLT Scheme - -Untitledmflatt@Macintosh \(Matthew Flatt\) + +PLT Scheme + +Untitledmflatt@Macintosh \(Matthew Flatt\) @@ -57,8 +57,8 @@ endstream endobj 2 0 obj <>endobj xref @@ -75,7 +75,7 @@ xref 0000000546 00000 n trailer << /Size 10 /Root 1 0 R /Info 2 0 R -/ID [<6E7272D6B2731DC8CB2BE347FB5EA742><6E7272D6B2731DC8CB2BE347FB5EA742>] +/ID [<18F7F7D89292F20542678B75862EDC0C><18F7F7D89292F20542678B75862EDC0C>] >> startxref 2184 diff --git a/collects/scribblings/quick/images/img5.pdf b/collects/scribblings/quick/images/img5.pdf index 772d873b337f4c36f703bcd2018bfe5adab69e44..f04c3d80a8a926bf7f94d51e6555c22ab2c3251c 100644 GIT binary patch delta 338 zcmbOvGD&2^7G@#Kq!f!3bE6bp3o|oQT|>jv#L35)>#+$(u*yy@VKK5XG|)9L(KRv( zF*LR^HMKG|(KRr$GB8kAs7NfZaxO|uEJ<|%Vq0}10}Q2;AF-rhH#-EI@IF=}EW(?a z*z}q73=IrSjEoG8O-;crPzSm|lS|(>KLupDhKm)*c7%$}@f=}{v91ONPA-nl2Cjx~ z7Di^S#x5?#hR#MNhQ>w~2F6C_rgk<2Rm5`H*>M$@Bo>ua6s4wd85tRwa;d7i`nz!f E0GcvYE&u=k delta 338 zcmbOvGD&2^7G|L|LrW9$G>bId#5Ch1T|>iE%gM)>>#+$(u*yy@VKK5Xu+%j$*EKQ< zF|@EUGPN=Va?Pv^4Ad1W5(})Hi&7IyQeA-9R^7+|L+Rv4EGgK{4#6h8kJSi^@Mb19 zeI`8vO9OKwBSQ-#Q?LuvfiBSG()Z0z0a>o$Vg<4tp<;79M;K$Qv9W=Xqp_u>p{1jV zldG|jfw`fvrG<-`v4ydPtD}>Joee=1v0Qd`T*W1cMI{wQscBqBMnH89aN zG72#?wlX!fGBug(&mx6Iw2CDKyD=fygu_^kun7a*vv~`vD3hL{fq{vUk)g4vsi}#s zftk92fx0G_zHfetOJYf?hKrSv0kVqC-`T?$om>n|4b0t)3@uF!49qNyEZtm;T!02R VJ6oC?nwdMA+u0COF}a^p8UV08Og#Vq delta 302 zcmZ1_yh?b353^93p{0p=nnjv!Vw!Q1uAyP7<>U`6Qj;r~Q?X0QPUc}T5;U;XH89sT zG72%Yure~WGPRuS&mx6Iw2CDKyD=fygu_^kun7a*vv~`vD3hLnrGdGTk)ef=sVUHY zGj#(4bxkgP-~1Gp#FA7E7b_zJWEGpgvxhM{xtW?8TDUknJDWKg8Ce=zx|z6`SvncJ VxtKY-xHy}e*x3+LF}a^p8UV+}PHzAJ diff --git a/collects/scribblings/quick/images/img7.pdf b/collects/scribblings/quick/images/img7.pdf index d2bcfd4e61d548248a9993d9537ddc7f51deee05..5d91589518be9350927fe9d221570ab05bbc6179 100644 GIT binary patch delta 346 zcmdllvR`DwLuMh%q!f!3bE6bp3o|oQT|>jv#L4<>Qj>XEQgKPmV==WcG|)9L(KRv( zF*LR^HMKG|(KRr$GB8kAs7NfZaxO|uEJ<|%Vq0}10}Q2;`B_tNnLVG?3Y*kxRwFFJ zoAufBne+?|3`~rS42?}q!LCpTxXIeI=VQT8@jo;7&tlG0X;}SMJ$({9anKlVo^y&QED2Ok&(Fpm#V6( HzZ(|-lrUEZ delta 346 zcmdllvR`DwLuR2gBcl{UGlMkU#5Ch1T|>iE%gOp|Qj>XEQgKPmV==Wcu+%j$*EKQ< zF|@EUGP5!;&@}*&>IxN!1y;^Qsfi`2ED5 zn?94Cfu(`Dk&&T=kr~((>Ofa$a_Rf#r+^%w;bH}H0Yb&*9*!`^SOX(xCsPYkV`nD= z7c(PE12=Og17|05LrV)IBWD9+H#-}GDq^|p?6`_c5{pVIic-_KjEu|;xKveL{oS|# D8+TVt diff --git a/collects/scribblings/quick/images/img8.pdf b/collects/scribblings/quick/images/img8.pdf index 9d824c87534034d1b8f1161093fa0eced58fb5a4..6666f2d5352801201c76da2f3e42e74e4737ab61 100644 GIT binary patch delta 284 zcmX>md`x&l2D6Z5Qi?^2xlxL)g_)VDuAyOS;$$9HsmW8AQ?X0QPS#*C5;Qc>H89aN zG72#?wlX!fGBuf;%_4h?Q96Cn7o=(8UUgb BMYjL| delta 284 zcmX>md`x&l2D4C_kx`1FnL(OvVw!Q1uAyP78XB5dS{S*yxR@FnnpqmS8k!h5nS;d4%#AGVYzV2CyqZ%Q0QFNv AQ2+n{ diff --git a/collects/scribblings/quick/images/img9.pdf b/collects/scribblings/quick/images/img9.pdf index ebc458cd74acbb818c388e33d7544760037bc60a..e106eda746f8fa6c304cb2b4e5206b5bcb03f4dd 100644 GIT binary patch delta 306 zcmZ1?wnS{hF%}`qq!f!3bE6bp3o|oQT|>jv#K~D~Qjl zWE5g(Y-MU{Won{pU}j}tpsrAnSYYK`l$uzQ>H@^J>P7|_N+*9|O~Gz<2sYshY)06G zfsWj)$1cjmV`yMtVq|1!Y-(z1GTEO~3`JmbA!it)lZlI=v7@QEiK~%`i;Ibgv74Eh Zql<-`fuWPBp_#dhv7HSe6_Yu+r2!~-O_cxu delta 306 zcmZ1?wnS{hF&3dTBcl{UGlMkU#5Ch1T|>iE%gI@6Qj`TrayBrrG&Z!ba56A7a56P8 XaW=CsbTc} in the interactions window and hit Enter, DrRacket evaluates the expression and prints its result. An expression can be just a value, such as the number -@scheme[5] or the string @scheme["art gallery"]: +@racket[5] or the string @racket["art gallery"]: @mr-interaction[5 "art gallery"] @@ -74,15 +74,15 @@ function arguments, and then a close parenthesis, like this: @mr-interaction[(circle 10)] -A result from the @scheme[circle] function is a picture value, which +A result from the @racket[circle] function is a picture value, which prints as an expression result in much the same way that numbers or -strings print. The argument to @scheme[circle] determines the +strings print. The argument to @racket[circle] determines the circle's size in pixels. As you might guess, there's a -@scheme[rectangle] function that takes two arguments instead of one: +@racket[rectangle] function that takes two arguments instead of one: @mr-interaction[(rectangle 10 20)] -Try giving @scheme[circle] the wrong number of arguments, just to see +Try giving @racket[circle] the wrong number of arguments, just to see what happens: @mr-interaction[(circle 10 20)] @@ -90,28 +90,28 @@ what happens: Note that DrRacket highlights in pink the expression that triggered the error (but pink highlighting is not shown in this documentation). -In addition to basic picture constructors like @scheme[circle] and -@scheme[rectangle], there's a @scheme[hc-append] function that +In addition to basic picture constructors like @racket[circle] and +@racket[rectangle], there's a @racket[hc-append] function that combines pictures. When you start composing function calls in Racket, it looks like this: @mr-interaction[(hc-append (circle 10) (rectangle 10 20))] -The hyphen in the name @scheme[hc-append] is just a part of the -identifier; it's not @schemeidfont{hc} minus -@schemeidfont{append}. The function name starts with @scheme[h] +The hyphen in the name @racket[hc-append] is just a part of the +identifier; it's not @racketidfont{hc} minus +@racketidfont{append}. The function name starts with @racket[h] because it combines pictures horizontally, and the next letter is -@scheme[c] because the pictures are centered vertically. +@racket[c] because the pictures are centered vertically. If you wonder what other functions exist---perhaps a way to stack pictures vertically and left-aligned?---move the text caret to the -name @scheme[hc-append] and press the F1 key in DrRacket. A browser +name @racket[hc-append] and press the F1 key in DrRacket. A browser window will open, and it will give you a link to the documentation for -@scheme[hc-append]. Click the link, and you'll see lots of other +@racket[hc-append]. Click the link, and you'll see lots of other functions. If you're reading this in HTML form, you can also just click on -@scheme[hc-append] or any other imported identifier that is used in +@racket[hc-append] or any other imported identifier that is used in this tutorial. @; ---------------------------------------------------------------------- @@ -122,34 +122,34 @@ simpler to give them names. Move back to the definitions area (the top area) and add two definitions, so that the complete content of the definitions area looks like this: -@mr-schememod+eval[ +@mr-racketmod+eval[ slideshow (define c (circle 10)) (define r (rectangle 10 20)) ] -Then click @onscreen{Run} again. Now, you can just type @scheme[c] or -@scheme[r]: +Then click @onscreen{Run} again. Now, you can just type @racket[c] or +@racket[r]: @mr-interaction[r (hc-append c r) (hc-append 20 c r c)] -As you can see, the @scheme[hc-append] function accepts an optional +As you can see, the @racket[hc-append] function accepts an optional number argument before the picture arguments, and it accepts any number of picture arguments. When a number is provided, it specifies the amount of space to add between pictures. -We could have evaluated the @scheme[define] forms for @scheme[c] and -@scheme[r] in the interactions area instead of the definitions +We could have evaluated the @racket[define] forms for @racket[c] and +@racket[r] in the interactions area instead of the definitions area. In practice, though, the definitions area is where your program lives---it's the file that you save---while the interaction area is for transient explorations and debugging tasks. Let's add a function definition to the program. A function definition -uses @scheme[define], just like our shape definitions, but with an +uses @racket[define], just like our shape definitions, but with an open parenthesis before the function name, and names for the function arguments before the matching close parenthesis: -@mr-schemeblock+eval[ +@mr-racketblock+eval[ (define (square n) (code:comment @#,t{A semi-colon starts a line comment.}) (code:comment @#,t{The expression below is the function body.}) @@ -173,7 +173,7 @@ definition area. @; ---------------------------------------------------------------------- @section{Local Binding} -The @scheme[define] form can be used in some places to create local +The @racket[define] form can be used in some places to create local bindings. For example, it can be used inside a function body: @mr-def+int[ @@ -183,10 +183,10 @@ bindings. For example, it can be used inside a function body: (four (circle 10)) ] -More typically, Racketeers use the @scheme[let] or @scheme[let*] form -for local binding. An advantage of @scheme[let] is that it can be used +More typically, Racketeers use the @racket[let] or @racket[let*] form +for local binding. An advantage of @racket[let] is that it can be used in any expression position. Also, it binds many identifiers at once, -instead of requiring a separate @scheme[define] for each identifier: +instead of requiring a separate @racket[define] for each identifier: @mr-def+int[ (define (checker p1 p2) @@ -197,8 +197,8 @@ instead of requiring a separate @scheme[define] for each identifier: (colorize (square 10) "black")) ] -A @scheme[let] form binds many identifiers at the same time, so the -bindings cannot refer to each other. The @scheme[let*] form, in +A @racket[let] form binds many identifiers at the same time, so the +bindings cannot refer to each other. The @racket[let*] form, in contrast, allows later bindings to use earlier bindings: @mr-def+int[ @@ -214,13 +214,13 @@ contrast, allows later bindings to use earlier bindings: @; ---------------------------------------------------------------------- @section{Functions are Values} -Instead of calling @scheme[circle] as a function, try evaluating just -@scheme[circle] as an expression: +Instead of calling @racket[circle] as a function, try evaluating just +@racket[circle] as an expression: @mr-interaction[circle] -That is, the identifier @scheme[circle] is bound to a function -(a.k.a. ``procedure''), just like @scheme[c] is bound to a +That is, the identifier @racket[circle] is bound to a function +(a.k.a. ``procedure''), just like @racket[c] is bound to a circle. Unlike a circle picture, there's not a simple way of completely printing the function, so DrRacket just prints @procedure{circle}. @@ -239,30 +239,30 @@ arguments: When calling a function that accepts a function argument, the argument function often isn't needed anywhere else. Having to write -down the function via @scheme[define] would be a hassle, because you +down the function via @racket[define] would be a hassle, because you have to make up a name and find a place to put the function -definition. The alternative is to use @scheme[lambda], which creates an +definition. The alternative is to use @racket[lambda], which creates an anonymous function: @mr-interaction[(series (lambda (size) (checkerboard (square size))))] -The parenthesized names after a @scheme[lambda] are the arguments to +The parenthesized names after a @racket[lambda] are the arguments to the function, and the expression after the argument names is the function body. Using the word ``lambda'' instead of ``function'' or ``procedure'' is part of Racket's history and culture. -A @scheme[define] form for a function is really a shorthand for a -simple @scheme[define] using @scheme[lambda] as the value. For -example, the @scheme[series] definition could be written as +A @racket[define] form for a function is really a shorthand for a +simple @racket[define] using @racket[lambda] as the value. For +example, the @racket[series] definition could be written as -@schemeblock[ +@racketblock[ (define series (lambda (mk) (hc-append 4 (mk 5) (mk 10) (mk 20)))) ] Most Racketeers prefer to use the shorthand function form with -@scheme[define] instead of expanding to @scheme[lambda]. +@racket[define] instead of expanding to @racket[lambda]. @; ---------------------------------------------------------------------- @section{Lexical Scope} @@ -270,12 +270,12 @@ Most Racketeers prefer to use the shorthand function form with Racket is a lexically scoped language, which means that whenever an identifier is used as an expression, something in the textual environment of the expression determines the identifier's -binding. This rule applies to identifiers in a @scheme[lambda] body as +binding. This rule applies to identifiers in a @racket[lambda] body as well as anywhere else. -For example, in the following @scheme[rgb-series] function the uses -of @scheme[mk] in each @scheme[lambda] form to refer to the argument of -@scheme[rgb-series], since that's the binding that is textually in +For example, in the following @racket[rgb-series] function the uses +of @racket[mk] in each @racket[lambda] form to refer to the argument of +@racket[rgb-series], since that's the binding that is textually in scope: @mr-def+int[ @@ -288,7 +288,7 @@ scope: (rgb-series square) ] -Here's another example, where @scheme[rgb-maker] takes a function and +Here's another example, where @racket[rgb-maker] takes a function and returns a new one that remembers and uses the original function. @mr-def+int[ @@ -301,9 +301,9 @@ returns a new one that remembers and uses the original function. (series (rgb-maker square)) ] -Note how composing functions via @scheme[rgb-maker] creates a +Note how composing functions via @racket[rgb-maker] creates a different alignment of objects within the picture compared to using -@scheme[rgb-series]. +@racket[rgb-series]. @; ---------------------------------------------------------------------- @section{Lists} @@ -312,25 +312,23 @@ Racket inherits much of its style from the language Lisp, whose name originally stood for ``LISt Processor,'' and lists remain an important part of Racket. -The @scheme[list] function takes any number of arguments and returns +The @racket[list] function takes any number of arguments and returns a list containing the given values: @mr-interaction[(list "red" "green" "blue") (list (circle 10) (square 10))] -As you can see, a list prints as a pair of parentheses wrapped around +As you can see, a list prints as a backquoted pair of parentheses wrapped around the printed form of the list elements. There's room for confusion here, because parentheses are used for both expressions, such as -@scheme[(circle 10)], and printed results, such as -@schemeresult[("red" "green" "blue")]. This connection between -expressions and printed results is no coincidence, but we save that -bit of culture for @seclink[#:doc '(lib -"scribblings/guide/guide.scrbl") "quoting-lists"]{discussion -elsewhere}. In the documentation and in DrRacket, result parentheses -are printed in blue, unlike expression parentheses. +@racket[(circle 10)], and printed results, such as +@racketresult[`("red" "green" "blue")]. The backquote is the key difference, +as @seclink[#:doc '(lib "scribblings/guide/guide.scrbl") "quoting-lists"]{discussed +elsewhere}. To help emphasize the difference, in the documentation and in DrRacket, +result parentheses are printed in blue, unlike expression parentheses. If you have a list, then you'll eventually want to do something with -each of the elements. The @scheme[map] function takes a list and a +each of the elements. The @racket[map] function takes a list and a function to apply to each element of the list; it returns a new list to combine the function's results: @@ -342,21 +340,21 @@ to combine the function's results: (rainbow (square 5)) ] -Another function that works with lists is @scheme[apply]. Like -@scheme[map], it takes a function and a list, but a function given -to @scheme[apply] should take all of the arguments at once, instead of -each one individually. The @scheme[apply] function is especially +Another function that works with lists is @racket[apply]. Like +@racket[map], it takes a function and a list, but a function given +to @racket[apply] should take all of the arguments at once, instead of +each one individually. The @racket[apply] function is especially useful with functions that take any number of arguments, such as -@scheme[vc-append]: +@racket[vc-append]: @mr-interaction[ (apply vc-append (rainbow (square 5))) ] -Note that @scheme[(vc-append (rainbow (square 5)))] would not work, -because @scheme[vc-append] does not want a list as an argument; it +Note that @racket[(vc-append (rainbow (square 5)))] would not work, +because @racket[vc-append] does not want a list as an argument; it wants a picture as an argument, and it is willing to accept any number -of them. The @scheme[apply] function bridges the gap between a +of them. The @racket[apply] function bridges the gap between a function that wants many arguments and a list of those arguments as a single value. @@ -365,17 +363,17 @@ single value. Since your program in the definitions window starts with -@schememod[slideshow] +@racketmod[slideshow] all of the code that you put in the definitions window is inside a module. Furthermore, the module initially imports everything from the -module designated by @schememodname[slideshow], which exports +module designated by @racketmodname[slideshow], which exports picture-making functions as well as more commonly used functions -such as @scheme[list] and @scheme[map]. +such as @racket[list] and @racket[map]. -To import additional libraries, use the @scheme[require] form. For -example, the library @schememodname[slideshow/flash] provides a -@scheme[filled-flash] function: +To import additional libraries, use the @racket[require] form. For +example, the library @racketmodname[slideshow/flash] provides a +@racket[filled-flash] function: @mr-def+int[ (require slideshow/flash) @@ -389,10 +387,10 @@ Modules are named and distributed in various ways: @item{Some modules are packaged in the Racket distribution or otherwise installed into a hierarchy of @defterm{collections}. For example, the module name - @schememodname[slideshow/flash] means ``the module implemented - in the file @filepath{flash.ss} that is located in the + @racketmodname[slideshow/flash] means ``the module implemented + in the file @filepath{flash.rkt} that is located in the @filepath{slideshow} collection.'' When a module name includes - no slash, then it refers to a @filepath{main.ss} file.} + no slash, then it refers to a @filepath{main.rkt} file.} @item{Some modules are distributed through the @link[url:planet]{@PLaneT} server, and they can be @@ -400,42 +398,42 @@ Modules are named and distributed in various ways: that you evaluate the following fragment: @mr-def+int[ - (require (planet "random.ss" ("schematics" "random.plt" 1 0))) + (require (planet "random.rkt" ("schematics" "random.plt" 1 0))) (random-gaussian) ] DrRacket automatically downloads version 1.0 of the @filepath{random.plt} library and then imports the - @filepath{random.ss} module.} + @filepath{random.rkt} module.} @item{Some modules live relative to other modules, without necessarily belonging to any particular collection or package. For example, in DrRacket, if you save your definitions so far in a - file @filepath{quick.ss} and add the line + file @filepath{quick.rkt} and add the line - @schemeblock[(provide rainbow square)] + @racketblock[(provide rainbow square)] then you can open a new tab or window in DrRacket, type the new - program @filepath{use.ss} in the same directory as - @filepath{quick.ss}: + program @filepath{use.rkt} in the same directory as + @filepath{quick.rkt}: - @schememod[ - scheme - (require "quick.ss") + @racketmod[ + racket + (require "quick.rkt") (rainbow (square 5)) ] - and when you run @filepath{use.ss}, a rainbow list of squares - is the output. Note that @filepath{use.ss} is written using - the initial import @schememodname[scheme], which does not + and when you run @filepath{use.rkt}, a rainbow list of squares + is the output. Note that @filepath{use.rkt} is written using + the initial import @racketmodname[racket], which does not supply any picture-making functions itself---but does provide - @scheme[require] and the function-calling syntax.} + @racket[require] and the function-calling syntax.} ] Racketeers typically write new programs and libraries as modules that import each other through relative paths, and that use existing -libraries from collections and @scheme[planet]. When a program or +libraries from collections and @racket[planet]. When a program or library developed this way seems useful to others, it can be uploaded as a @PLaneT package or distributed in the more old-fashioned way as an installable collection archive (in either case without modifying @@ -453,13 +451,13 @@ Here's another library to try: Instead of a circle, the result is a picture of the code that, if it were used as an expression, would produce a circle. In other words, -@scheme[code] is not a function, but instead a new syntactic form for +@racket[code] is not a function, but instead a new syntactic form for creating pictures; the bit between the opening parenthesis with -@scheme[code] is not an expression, but instead manipulated by the -@scheme[code] syntactic form. +@racket[code] is not an expression, but instead manipulated by the +@racket[code] syntactic form. This helps explain what we meant in the previous section when we said -that @schememodname[scheme] provides @scheme[require] and the +that @racketmodname[racket] provides @racket[require] and the function-calling syntax. Libraries are not restricted to exporting values, such as functions; they can also define new syntactic forms. In this sense, Racket isn't exactly a language at all; it's @@ -467,7 +465,7 @@ more of an idea for how to structure a language so that you can extend it or create entirely new languages. One way to introduce a new syntactic form is through -@scheme[define-syntax] with @scheme[syntax-rules]: +@racket[define-syntax] with @racket[syntax-rules]: @mr-def+int[ (define-syntax pict+code @@ -479,27 +477,27 @@ One way to introduce a new syntactic form is through (pict+code (circle 10)) ] -This kind of definition is a macro. The @scheme[(pict+code expr)] part +This kind of definition is a macro. The @racket[(pict+code expr)] part is a pattern for uses of the macro; instances of the pattern in a program are replaced by instances of the corresponding template, which -is @scheme[(hc-append 10 expr (code expr))]. In particular, -@scheme[(pict+code (circle 10))] matches the pattern with -@scheme[(circle 10)] as @scheme[expr], so it is replaced with -@scheme[(hc-append 10 (circle 10) (code (circle 10)))]. +is @racket[(hc-append 10 expr (code expr))]. In particular, +@racket[(pict+code (circle 10))] matches the pattern with +@racket[(circle 10)] as @racket[expr], so it is replaced with +@racket[(hc-append 10 (circle 10) (code (circle 10)))]. Of course, the sword of syntactic extension cuts both ways: inventing a new language can make it easier to say what you want, but harder for others to understand. As it happens, the developers of Racket are constantly giving talks and writing papers that involve Racket code, and it's worthwhile for everyone who works on those products to know -about @scheme[code]. +about @racket[code]. In fact, you might want to take a look at the @keep-file["quick.scrbl"] @link["quick.scrbl"]{source of this document}. You'll see that it -starts with @schemefont{#lang}, but otherwise doesn't look a lot +starts with @racketfont{#lang}, but otherwise doesn't look a lot like Racket; nevertheless, we build this document by running its source as a Racket program. We have to use a lot more than -@scheme[syntax-rules] to extend Racket's syntax enough for writing +@racket[syntax-rules] to extend Racket's syntax enough for writing documents, but Racket's syntactic extension can take you a long way. @; ---------------------------------------------------------------------- @@ -508,18 +506,18 @@ documents, but Racket's syntactic extension can take you a long way. An object system is another example of a sophisticated language extension that is worth learning and using for Racket users. Objects are sometimes better than functions, even when you have -@scheme[lambda], and objects work especially well for graphical user +@racket[lambda], and objects work especially well for graphical user interfaces. The API for Racket's GUI and graphics system is expressed in terms of objects and classes. The class system itself is implemented by the -@schememodname[scheme/class] library, and the -@schememodname[scheme/gui/base] library provides the GUI and drawing +@racketmodname[racket/class] library, and the +@racketmodname[racket/gui/base] library provides the GUI and drawing classes. By convention, the classes are given names that end with -@scheme[%]: +@racket[%]: @mr-defs+int[ -[(require scheme/class scheme/gui/base) +[(require racket/class racket/gui/base) (define f (new frame% [label "My Art"] [width 300] [height 300] @@ -529,18 +527,18 @@ classes. By convention, the classes are given names that end with @(mr-interaction-eval (send f show #f)) -The @scheme[new] form creates an instance of a class, where -initialization arguments like @scheme[label] and @scheme[width] are -provided by name. The @scheme[send] form calls a method of the object, -such as @scheme[show], with arguments after the method name; the -argument @scheme[#t] in this case is the boolean constant ``true.'' +The @racket[new] form creates an instance of a class, where +initialization arguments like @racket[label] and @racket[width] are +provided by name. The @racket[send] form calls a method of the object, +such as @racket[show], with arguments after the method name; the +argument @racket[#t] in this case is the boolean constant ``true.'' -Pictures generated with @schememodname[slideshow] encapsulate a +Pictures generated with @racketmodname[slideshow] encapsulate a function that uses the graphics toolbox's drawing commands to render the picture to a drawing context, such as a canvas in a frame. The -@scheme[make-pict-drawer] function from @schememodname[slideshow] +@racket[make-pict-drawer] function from @racketmodname[slideshow] exposes a picture's drawing function. We can use -@scheme[make-pict-drawer] in a canvas-painting callback to draw a +@racket[make-pict-drawer] in a canvas-painting callback to draw a picture into a canvas: @mr-def+int[ @@ -571,8 +569,8 @@ that's how a frame manages its children by default. This introduction to Racket purposely avoids many of the traditional ways of introducing and distinguishing Lisp or Racket: prefix arithmetic notation, symbols, quoting and quasiquoting lists, -@scheme[eval], first-class continuations, and the idea that all syntax -is really just a @scheme[lambda] in disguise. While those are all part +@racket[eval], first-class continuations, and the idea that all syntax +is really just a @racket[lambda] in disguise. While those are all part of Racket, they are not the main ingredients of day-to-day programming in Racket. diff --git a/collects/scribblings/reference/async-channels.scrbl b/collects/scribblings/reference/async-channels.scrbl index 4030c5fc7a..22de9ad336 100644 --- a/collects/scribblings/reference/async-channels.scrbl +++ b/collects/scribblings/reference/async-channels.scrbl @@ -1,16 +1,16 @@ #lang scribble/doc @(require "mz.ss" - (for-label scheme/async-channel)) + (for-label racket/async-channel)) @(define async-eval (lambda () (let ([the-eval (make-base-eval)]) - (the-eval '(require scheme/async-channel)) + (the-eval '(require racket/async-channel)) the-eval))) @title[#:tag "async-channel"]{Buffered Asynchronous Channels} -@note-lib-only[scheme/async-channel] +@note-lib-only[racket/async-channel] @margin-note/ref{See also @secref["threadmbox"].} diff --git a/collects/scribblings/reference/booleans.scrbl b/collects/scribblings/reference/booleans.scrbl index 740b00b2f2..5fce281a2f 100644 --- a/collects/scribblings/reference/booleans.scrbl +++ b/collects/scribblings/reference/booleans.scrbl @@ -218,7 +218,7 @@ values. For opaque structure types, @scheme[equal?] is the same as @section{Boolean Synonyms} -@note-lib[scheme/bool] +@note-lib[racket/bool] @defthing[true boolean?]{A synonym for @scheme[#t].} diff --git a/collects/scribblings/reference/class.scrbl b/collects/scribblings/reference/class.scrbl index 0fa70a1852..dc6218ed6e 100644 --- a/collects/scribblings/reference/class.scrbl +++ b/collects/scribblings/reference/class.scrbl @@ -1,8 +1,8 @@ #lang scribble/doc @(require "mz.ss" - scheme/class - (for-syntax scheme/base) - (for-label scheme/trait)) + racket/class + (for-syntax racket/base) + (for-label racket/trait)) @(begin @@ -70,14 +70,14 @@ ) -@(interaction-eval #:eval class-eval (require scheme/class)) +@(interaction-eval #:eval class-eval (require racket/class)) @title[#:tag "mzlib:class" #:style 'toc]{Classes and Objects} @guideintro["classes"]{classes and objects} -@note-lib[scheme/class #:use-sources (racket/private/class-internal)] +@note-lib[racket/class #:use-sources (racket/private/class-internal)] A @deftech{class} specifies @@ -1275,7 +1275,7 @@ Evaluation of a @scheme[mixin] form checks that the @section[#:tag "trait"]{Traits} -@note-lib-only[scheme/trait] +@note-lib-only[racket/trait] A @deftech{trait} is a collection of methods that can be converted to a @tech{mixin} and then applied to a @tech{class}. Before a trait is diff --git a/collects/scribblings/reference/cmdline.scrbl b/collects/scribblings/reference/cmdline.scrbl index 237c72a1bc..147d90b5c6 100644 --- a/collects/scribblings/reference/cmdline.scrbl +++ b/collects/scribblings/reference/cmdline.scrbl @@ -1,10 +1,10 @@ #lang scribble/doc @(require "mz.ss" - (for-label scheme/cmdline)) + (for-label racket/cmdline)) @title{Command-Line Parsing} -@note-lib[scheme/cmdline] +@note-lib[racket/cmdline] @defform/subs[#:literals (multi once-each once-any final jelp-labels args help-labels =>) diff --git a/collects/scribblings/reference/concurrency.scrbl b/collects/scribblings/reference/concurrency.scrbl index cf384281ae..be2c6f312c 100644 --- a/collects/scribblings/reference/concurrency.scrbl +++ b/collects/scribblings/reference/concurrency.scrbl @@ -6,7 +6,7 @@ PLT Scheme supports multiple threads of control within a program, thread-local storage, some primitive synchronization mechanisms, and a framework for composing synchronization abstractions. In addition, the -@scheme[scheme/future] library provides some support for parallelism +@scheme[racket/future] library provides some support for parallelism to improve performance. @local-table-of-contents[] diff --git a/collects/scribblings/reference/contracts.scrbl b/collects/scribblings/reference/contracts.scrbl index 343bd3bdf5..1195ccf56c 100644 --- a/collects/scribblings/reference/contracts.scrbl +++ b/collects/scribblings/reference/contracts.scrbl @@ -5,7 +5,7 @@ @(define contract-eval (lambda () (let ([the-eval (make-base-eval)]) - (the-eval '(require scheme/contract)) + (the-eval '(require racket/contract)) the-eval))) @title[#:tag "contracts" #:style 'toc]{Contracts} @@ -17,7 +17,7 @@ another. Programmers specify the behavior of a module exports via @scheme[provide/contract] and the contract system enforces those constraints. -@note-lib[scheme/contract #:use-sources (racket/contract/private/ds +@note-lib[racket/contract #:use-sources (racket/contract/private/ds racket/contract/private/base racket/contract/private/guts racket/contract/private/misc diff --git a/collects/scribblings/reference/control-lib.scrbl b/collects/scribblings/reference/control-lib.scrbl index 2af91d9930..ed46da84cc 100644 --- a/collects/scribblings/reference/control-lib.scrbl +++ b/collects/scribblings/reference/control-lib.scrbl @@ -1,17 +1,17 @@ #lang scribble/doc -@(require "mz.ss" - (for-label scheme/control)) +@(require (except-in "mz.ss" set) + (for-label racket/control)) @title{Classical Control Operators} -@note-lib-only[scheme/control] +@note-lib-only[racket/control] @(define control-eval (let ([the-eval (make-base-eval)]) - (the-eval '(require scheme/control)) + (the-eval '(require racket/control)) the-eval)) -The @scheme[scheme/control] library provides various control operators +The @scheme[racket/control] library provides various control operators from the research literature on higher-order control operators, plus a few extra convenience forms. These control operators are implemented in terms of @scheme[call-with-continuation-prompt], diff --git a/collects/scribblings/reference/define-struct.scrbl b/collects/scribblings/reference/define-struct.scrbl index fbc45d9af6..408b26aa13 100644 --- a/collects/scribblings/reference/define-struct.scrbl +++ b/collects/scribblings/reference/define-struct.scrbl @@ -1,19 +1,19 @@ #lang scribble/doc @(require "mz.ss" - (for-syntax scheme/base) - (for-label scheme/serialize)) + (for-syntax racket/base) + (for-label racket/serialize)) @(define posn-eval (make-base-eval)) -@(interaction-eval #:eval posn-eval (require (for-syntax scheme/base))) +@(interaction-eval #:eval posn-eval (require (for-syntax racket/base))) -@title[#:tag "define-struct"]{Defining Structure Types: @scheme[define-struct]} +@title[#:tag "define-struct"]{Defining Structure Types: @scheme[struct]} @guideintro["define-struct"]{@scheme[define-struct]} -@defform/subs[(define-struct id-maybe-super (field ...) - struct-option ...) - ([id-maybe-super id - (id super-id)] +@defform/subs[(struct id maybe-super (field ...) + struct-option ...) + ([maybe-super code:blank + super-id] [field field-id [field-id field-option ...]] [struct-option #:mutable @@ -34,7 +34,7 @@ Creates a new @techlink{structure type} (or uses a pre-existing structure type if @scheme[#:prefab] is specified), and binds transformers and variables related to the @tech{structure type}. -A @scheme[define-struct] form with @math{n} @scheme[field]s defines up +A @scheme[struct] form with @math{n} @scheme[field]s defines up to @math{4+2n} names: @itemize[ @@ -42,16 +42,15 @@ to @math{4+2n} names: @item{@schemeidfont{struct:}@scheme[id], a @deftech{structure type descriptor} value that represents the @tech{structure type}.} - @item{@scheme[constructor-id] (which defaults to - @schemeidfont{make-}@scheme[id]), a @deftech{constructor} - procedure that takes @math{m} arguments and returns a new - instance of the @tech{structure type}, where @math{m} is the - number of @scheme[field]s that do not include an - @scheme[#:auto] option.} + @item{@scheme[constructor-id] (which defaults to @scheme[id]), a + @deftech{constructor} procedure that takes @math{m} arguments + and returns a new instance of the @tech{structure type}, where + @math{m} is the number of @scheme[field]s that do not include + an @scheme[#:auto] option.} @item{@scheme[id]@schemeidfont{?}, a @deftech{predicate} procedure that returns @scheme[#t] for instances of the @tech{structure - type} (constructed by @schemeidfont{make-}@scheme[id] or the + type} (constructed by @scheme[constructor-id] or the @tech{constructor} for a subtype) and @scheme[#f] for any other value.} @@ -125,7 +124,7 @@ If the @scheme[#:omit-define-syntaxes] option is supplied, then @scheme[id] is not bound as a transformer. If the @scheme[#:omit-define-values] option is supplied, then none of the usual variables are bound, but @scheme[id] is bound. If both are -supplied, then the @scheme[define-struct] form is equivalent to +supplied, then the @scheme[struct] form is equivalent to @scheme[(begin)]. If @scheme[#:auto] is supplied as a @scheme[field-option], then the @@ -147,27 +146,28 @@ For serialization, see @scheme[define-serializable-struct]. @defexamples[ #:eval posn-eval -(define-struct posn (x y [z #:auto]) - #:auto-value 0 - #:transparent) -(make-posn 1 2) -(posn? (make-posn 1 2)) -(posn-y (make-posn 1 2)) +(struct posn (x y [z #:auto]) + #:auto-value 0 + #:transparent) +(posn 1 2) +(posn? (posn 1 2)) +(posn-y (posn 1 2)) ] @defs+int[ #:eval posn-eval -[(define-struct (color-posn posn) (hue) #:mutable) - (define cp (make-color-posn 1 2 "blue"))] +[(struct color-posn posn (hue) #:mutable) + (define cp (color-posn 1 2 "blue"))] (color-posn-hue cp) cp (set-posn-z! cp 3) ]} + @defform[(struct-field-index field-id)]{ This form can only appear as an expression within a -@scheme[define-struct] form; normally, it is used with +@scheme[struct] form; normally, it is used with @scheme[#:property], especially for a property like @scheme[prop:procedure]. The result of a @scheme[struct-field-index] expression is an exact, non-negative integer that corresponds to the @@ -176,13 +176,37 @@ position within the structure declaration of the field named by @defexamples[ #:eval posn-eval -(define-struct mood-procedure (base rating) - #:property prop:procedure (struct-field-index base)) -(define happy+ (make-mood-procedure add1 10)) +(struct mood-procedure (base rating) + #:property prop:procedure (struct-field-index base)) +(define happy+ (mood-procedure add1 10)) (happy+ 2) (mood-procedure-rating happy+) ]} + +@defform/subs[(define-struct id-maybe-super (field ...) + struct-option ...) + ([id-maybe-super id + (id super-id)])]{ + +Like @scheme[struct], except that the syntax for supplying a +@scheme[super-id] is different, and the default constructor name +use a @schemeidfont{make-} prefix on @scheme[id]. + +This form is provided for backward compatibility; @scheme[struct] is +preferred. + +@defexamples[ +#:eval posn-eval +(define-struct posn (x y [z #:auto]) + #:auto-value 0 + #:transparent) +(make-posn 1 2) +(posn? (make-posn 1 2)) +(posn-y (make-posn 1 2)) +]} + + @defform[(define-struct/derived (id . rest-form) id-maybe-super (field ...) struct-option ...)]{ diff --git a/collects/scribblings/reference/dicts.scrbl b/collects/scribblings/reference/dicts.scrbl index e71170058d..c811a74596 100644 --- a/collects/scribblings/reference/dicts.scrbl +++ b/collects/scribblings/reference/dicts.scrbl @@ -3,7 +3,7 @@ scribble/eval) @(define dict-eval (make-base-eval)) -@(interaction-eval #:eval dict-eval (require scheme/dict)) +@(interaction-eval #:eval dict-eval (require racket/dict)) @title[#:tag "dicts"]{Dictionaries} @@ -24,7 +24,7 @@ values. The following datatypes are all dictionaries: ] -@note-lib[scheme/dict] +@note-lib[racket/dict] @defproc[(dict? [v any/c]) boolean?]{ diff --git a/collects/scribblings/reference/encodings.scrbl b/collects/scribblings/reference/encodings.scrbl index d19a2b02af..73141ac6c9 100644 --- a/collects/scribblings/reference/encodings.scrbl +++ b/collects/scribblings/reference/encodings.scrbl @@ -1,6 +1,6 @@ #lang scribble/doc @(require "mz.ss" - (for-label scheme/port)) + (for-label racket/port)) @title[#:tag "encodings"]{Encodings and Locales} diff --git a/collects/scribblings/reference/enter.scrbl b/collects/scribblings/reference/enter.scrbl index 7c5141c774..35d894de01 100644 --- a/collects/scribblings/reference/enter.scrbl +++ b/collects/scribblings/reference/enter.scrbl @@ -1,10 +1,10 @@ #lang scribble/doc @(require "mz.ss" - (for-label scheme/enter)) + (for-label racket/enter)) @title[#:tag "enter"]{Interactive Module Loading} -@note-init-lib[scheme/enter] +@note-init-lib[racket/enter] @defform*[[(enter! module-path) (enter! #f)]]{ @@ -27,7 +27,7 @@ are first loaded (either directly or indirectly through transitive @scheme[require]s) via @scheme[enter!]. After switching namespaces to the designated module, @scheme[enter!] -automatically requires @scheme[scheme/enter] into the namespace, so +automatically requires @scheme[racket/enter] into the namespace, so that @scheme[enter!] can be used to switch namespaces again. When it loads or re-loads a module from a file, @scheme[enter!] prints diff --git a/collects/scribblings/reference/eval-model.scrbl b/collects/scribblings/reference/eval-model.scrbl index a1b77ded73..b0692ded20 100644 --- a/collects/scribblings/reference/eval-model.scrbl +++ b/collects/scribblings/reference/eval-model.scrbl @@ -1,7 +1,7 @@ #lang scribble/doc @(require scribble/struct scribble/scheme - (for-syntax scheme/base) + (for-syntax racket/base) "mz.ss" "prog-steps.ss") diff --git a/collects/scribblings/reference/exns.scrbl b/collects/scribblings/reference/exns.scrbl index 7582b1cb6d..5e00b7d9af 100644 --- a/collects/scribblings/reference/exns.scrbl +++ b/collects/scribblings/reference/exns.scrbl @@ -1,7 +1,7 @@ #lang scribble/doc @(require scribble/bnf "mz.ss" - (for-label scheme/fixnum)) + (for-label racket/fixnum)) @title[#:tag "exns"]{Exceptions} diff --git a/collects/scribblings/reference/file-ports.scrbl b/collects/scribblings/reference/file-ports.scrbl index 12f3e1ef82..b93002bcfc 100644 --- a/collects/scribblings/reference/file-ports.scrbl +++ b/collects/scribblings/reference/file-ports.scrbl @@ -1,6 +1,6 @@ #lang scribble/doc @(require "mz.ss" - scheme/file) + racket/file) @(begin ;; ignore expressions at the top-level so that they don't print # @@ -12,8 +12,8 @@ (define file-eval (lambda () (let ([the-eval (make-base-eval)]) - (the-eval '(require (for-syntax scheme/base) - scheme/file)) + (the-eval '(require (for-syntax racket/base) + racket/file)) (the-eval '(define some-file (make-temporary-file))) (the-eval '(define some-other-file (make-temporary-file))) the-eval))) diff --git a/collects/scribblings/reference/filesystem.scrbl b/collects/scribblings/reference/filesystem.scrbl index 64bc2ee002..54019bc9a1 100644 --- a/collects/scribblings/reference/filesystem.scrbl +++ b/collects/scribblings/reference/filesystem.scrbl @@ -1,7 +1,7 @@ #lang scribble/doc @(require "mz.ss" (for-label framework/preferences - scheme/runtime-path + racket/runtime-path setup/dirs)) @title{Filesystem} @@ -398,9 +398,9 @@ can be particularly slow under Windows.} @;------------------------------------------------------------------------ @section[#:tag "runtime-path"]{Declaring Paths Needed at Run Time} -@note-lib-only[scheme/runtime-path] +@note-lib-only[racket/runtime-path] -The @schememodname[scheme/runtime-path] library provides forms for +The @schememodname[racket/runtime-path] library provides forms for accessing files and directories at run time using a path that are usually relative to an enclosing source file. Unlike using @scheme[collection-path], @scheme[define-runtime-path] exposes each @@ -409,7 +409,7 @@ so that files and directories needed at run time are carried along in a distribution. In addition to the bindings described below, -@schememodname[scheme/runtime-path] provides @scheme[#%datum] in +@schememodname[racket/runtime-path] provides @scheme[#%datum] in @tech{phase level} 1, since string constants are often used as compile-time expressions with @scheme[define-runtime-path]. @@ -426,7 +426,7 @@ result of @scheme[expr]. The path is normally computed by taking a relative path result from @scheme[expr] and adding it to a path for the enclosing file (which is computed as described below). However, tools like the executable creator can also arrange (by colluding with -@schememodname[scheme/runtime-path]) to have a different base path +@schememodname[racket/runtime-path]) to have a different base path substituted in a generated executable. If @scheme[expr] produces an absolute path, it is normally returned directly, but again may be replaced by an executable creator. In all cases, the executable @@ -579,7 +579,7 @@ bound through @scheme[define-runtime-module-path].} @;------------------------------------------------------------------------ @section[#:tag "file-lib"]{More File and Directory Utilities} -@note-lib[scheme/file] +@note-lib[racket/file] @defproc[(file->string [path path-string?] [#:mode mode-flag (or/c 'binary 'text) 'binary]) diff --git a/collects/scribblings/reference/futures.scrbl b/collects/scribblings/reference/futures.scrbl index 45b44228b0..b327351f0c 100644 --- a/collects/scribblings/reference/futures.scrbl +++ b/collects/scribblings/reference/futures.scrbl @@ -1,18 +1,15 @@ #lang scribble/doc @(require "mz.ss" - (for-label scheme - scheme/base - scheme/contract - scheme/future)) + (for-label racket/future)) @(define future-eval (make-base-eval)) -@(interaction-eval #:eval future-eval (require scheme/future)) +@(interaction-eval #:eval future-eval (require racket/future)) @title[#:tag "futures"]{Futures for Parallelism} @guideintro["effective-futures"]{futures} -@note-lib[scheme/future] +@note-lib[racket/future] @margin-note{Currently, parallel support for @scheme[future] is enabled by default for Windows, Linux x86/x86_64, and Mac OS X @@ -21,7 +18,7 @@ x86/x86_64. To enable support for other platforms, use Scheme.} The @scheme[future] and @scheme[touch] functions from -@schememodname[scheme/future] provide access to parallelism as +@schememodname[racket/future] provide access to parallelism as supported by the hardware and operation system. In contrast to @scheme[thread], which provides concurrency for arbitrary computations without parallelism, @scheme[future] provides diff --git a/collects/scribblings/reference/help.scrbl b/collects/scribblings/reference/help.scrbl index 7e2d4dc906..bdd8bc56ab 100644 --- a/collects/scribblings/reference/help.scrbl +++ b/collects/scribblings/reference/help.scrbl @@ -2,9 +2,9 @@ @(require "mz.ss" scribble/core scribble/html-properties - (for-label scheme/help + (for-label racket/help net/url - scheme/gui)) + racket/gui/base)) @; Beware of this hard-wired link to the main doc page: @(define main-doc-page @@ -18,7 +18,7 @@ @title{Interactive Help} -@note-init-lib[scheme/help] +@note-init-lib[racket/help] @deftogether[( @defidform[help] @@ -67,8 +67,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 racket/gui) (code:comment @#,t{does not work in @exec{mzscheme}}) +(require (for-label racket/gui)) (code:comment @#,t{ok in @exec{mzscheme}}) (help frame%) ] @@ -82,7 +82,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 racket/gui) (code:comment @#,t{equivalent to the above}) ] The @scheme[(help #:search datum ...)] form is similar to diff --git a/collects/scribblings/reference/include.scrbl b/collects/scribblings/reference/include.scrbl index 2fe0004d92..6e5f3f9ccd 100644 --- a/collects/scribblings/reference/include.scrbl +++ b/collects/scribblings/reference/include.scrbl @@ -3,7 +3,7 @@ @title[#:tag "include"]{File Inclusion} -@note-lib[scheme/include] +@note-lib[racket/include] @defform/subs[#:literals (file lib) (include path-spec) diff --git a/collects/scribblings/reference/init.scrbl b/collects/scribblings/reference/init.scrbl index 973edaed63..f03e410ef8 100644 --- a/collects/scribblings/reference/init.scrbl +++ b/collects/scribblings/reference/init.scrbl @@ -1,18 +1,18 @@ #lang scribble/doc @(require "mz.ss" - (for-label scheme/pretty - scheme/gui/base)) + (for-label racket/pretty + racket/gui/base)) @title{Init Libraries} -@defmodule*/no-declare[(scheme/init)]{The @schememodname[scheme/init] +@defmodule*/no-declare[(racket/init)]{The @schememodname[racket/init] library is the default start-up library for MzScheme. It re-exports -the @schememodname[scheme], @schememodname[scheme/enter] and -@schememodname[scheme/help] libraries, and it sets +the @schememodname[scheme], @schememodname[racket/enter] and +@schememodname[racket/help] libraries, and it sets @scheme[current-print] to use @scheme[pretty-print].} -@defmodule*/no-declare[(scheme/gui/init)]{The -@schememodname[scheme/gui/init] library is the default start-up -library for MrEd. It re-exports the @schememodname[scheme/init] and -@schememodname[scheme/gui/base] libraries, and it sets +@defmodule*/no-declare[(racket/gui/init)]{The +@schememodname[racket/gui/init] library is the default start-up +library for MrEd. It re-exports the @schememodname[racket/init] and +@schememodname[racket/gui/base] libraries, and it sets @scheme[current-load] to use @scheme[text-editor-load-handler].} diff --git a/collects/scribblings/reference/load-lang.scrbl b/collects/scribblings/reference/load-lang.scrbl index 6487364666..8dee2957d8 100644 --- a/collects/scribblings/reference/load-lang.scrbl +++ b/collects/scribblings/reference/load-lang.scrbl @@ -1,59 +1,59 @@ #lang scribble/doc @(require "mz.ss") -@title[#:tag "load-lang"]{The @schememodname[scheme/load] Language} +@title[#:tag "load-lang"]{The @schememodname[racket/load] Language} -@defmodulelang[scheme/load] +@defmodulelang[racket/load] -The @schememodname[scheme/load] language supports traditional Scheme +The @schememodname[racket/load] language supports traditional Scheme evaluation, where each top-level form in the module body is separately passed to @scheme[eval] in the same way as for @scheme[load]. The namespace for evaluation shares the @tech{module registry} with -the @schememodname[scheme/load] module instance, but it has a separate +the @schememodname[racket/load] module instance, but it has a separate top-level environment, and it is initialized with the bindings of @schememodname[scheme]. A single namespace is created for each -instance of the @schememodname[scheme/load] module (i.e., multiple -modules using the @schememodname[scheme/load] language share a -namespace). The @scheme[scheme/load] library exports only +instance of the @schememodname[racket/load] module (i.e., multiple +modules using the @schememodname[racket/load] language share a +namespace). The @scheme[racket/load] library exports only @schemeidfont{#%module-begin} and @schemeidfont{#%top-interaction} forms that effectively swap in the evaluation namespace and call @scheme[eval]. -For example, the body of a module using @scheme[scheme/load] can +For example, the body of a module using @scheme[racket/load] can include @scheme[module] forms, so that running the following module prints @schemeresultfont{5}: @schememod[ -scheme/load +racket/load -(module m scheme/base +(module m racket/base (provide x) (define x 5)) -(module n scheme/base +(module n racket/base (require 'm) (display x)) (require 'n) ] -Definitions in a module using @scheme[scheme/load] are evaluated in +Definitions in a module using @scheme[racket/load] are evaluated in the current namespace, which means that @scheme[load] and @scheme[eval] can see the definitions. For example, running the following module prints @schemeresultfont{6}: @schememod[ -scheme/load +racket/load (define x 6) (display (eval 'x)) ] -Since all forms within a @schememodname[scheme/load] module are +Since all forms within a @schememodname[racket/load] module are evaluated in the top level, bindings cannot be exported from the module using @scheme[provide]. Similarly, since evaluation of the module-body forms is inherently dynamic, compilation of the module provides essentially no benefit. For these reasons, use -@schememodname[scheme/load] for interactive exploration of top-level +@schememodname[racket/load] for interactive exploration of top-level forms only, and not for constructing larger programs. diff --git a/collects/scribblings/reference/logging.scrbl b/collects/scribblings/reference/logging.scrbl index cb260c91f5..261a29ded6 100644 --- a/collects/scribblings/reference/logging.scrbl +++ b/collects/scribblings/reference/logging.scrbl @@ -1,6 +1,6 @@ #lang scribble/doc @(require "mz.ss" - (for-label scheme/cmdline)) + (for-label racket/cmdline)) @title[#:tag "logging"]{Logging} diff --git a/collects/scribblings/reference/match-parse.ss b/collects/scribblings/reference/match-parse.ss index e482dd48b9..c68f9ca492 100644 --- a/collects/scribblings/reference/match-parse.ss +++ b/collects/scribblings/reference/match-parse.ss @@ -1,9 +1,9 @@ -#lang scheme/base +#lang racket/base (require scribble/scheme scribble/basic scribble/struct scribble/manual - (for-label scheme/base)) + (for-label racket/base)) (provide parse-match-grammar) diff --git a/collects/scribblings/reference/match.scrbl b/collects/scribblings/reference/match.scrbl index 70adf0c679..c07c85cf1c 100644 --- a/collects/scribblings/reference/match.scrbl +++ b/collects/scribblings/reference/match.scrbl @@ -1,10 +1,10 @@ #lang scribble/doc @(require "mz.ss" "match-grammar.ss" - scheme/match) + racket/match) @(define match-eval (make-base-eval)) -@(interaction-eval #:eval match-eval (require scheme/match)) +@(interaction-eval #:eval match-eval (require racket/match)) @title[#:tag "match"]{Pattern Matching} @@ -14,7 +14,7 @@ The @scheme[match] form and related forms support general pattern matching on Scheme values. See also @secref["regexp"] for information on regular-expression matching on strings, bytes, and streams. -@note-lib[scheme/match #:use-sources (scheme/match)] +@note-lib[racket/match #:use-sources (racket/match)] @defform/subs[(match val-expr clause ...) ([clause [pat expr ...+] diff --git a/collects/scribblings/reference/mpairs.scrbl b/collects/scribblings/reference/mpairs.scrbl index 16402c0149..ccd5631f43 100644 --- a/collects/scribblings/reference/mpairs.scrbl +++ b/collects/scribblings/reference/mpairs.scrbl @@ -1,7 +1,7 @@ #lang scribble/doc @(require "mz.ss" scribble/scheme - (for-label scheme/mpair)) + (for-label racket/mpair)) @title[#:tag "mpairs"]{Mutable Pairs and Lists} @@ -52,7 +52,7 @@ Changes the @tech{mutable pair} @scheme[p] so that its second element is @; ---------------------------------------- @section{Mutable List Functions} -@note-lib-only[scheme/mpair] +@note-lib-only[racket/mpair] For functions described in this section, contracts are not directly enforced. In particular, when a @tech{mutable list} is expected, diff --git a/collects/scribblings/reference/mz.ss b/collects/scribblings/reference/mz.ss index d9b3976907..f4055713fb 100644 --- a/collects/scribblings/reference/mz.ss +++ b/collects/scribblings/reference/mz.ss @@ -1,17 +1,17 @@ -(module mz scheme/base +(module mz racket/base (require scribble/struct scribble/manual scribble/eval scribble/decode - scheme/contract + racket/contract "../icons.ss") (provide (all-from-out scribble/manual) (all-from-out scribble/eval) - (all-from-out scheme/contract)) + (all-from-out racket/contract)) - (require (for-label scheme)) - (provide (for-label (all-from-out scheme))) + (require (for-label racket)) + (provide (for-label (all-from-out racket))) (provide mz-examples) (define mz-eval (make-base-eval)) @@ -30,7 +30,7 @@ (syntax-rules () [(_ lib #:use-sources (src ...) . more) (begin - (declare-exporting lib scheme #:use-sources (src ...)) + (declare-exporting lib racket #:use-sources (src ...)) (defmodule*/no-declare (lib) (t (make-collect-element #f null @@ -39,8 +39,8 @@ "The bindings documented in this section are provided by the " (schememodname lib) " and " - (schememodname scheme) - " libraries, but not " (schememodname scheme/base) + (schememodname racket) + " libraries, but not " (schememodname racket/base) "." . more)))] [(_ lib . more) @@ -51,16 +51,16 @@ (syntax-rules () [(_ lib #:use-sources (src ...) . more) (begin - (declare-exporting lib scheme/init #:use-sources (src ...)) + (declare-exporting lib racket/init #:use-sources (src ...)) (defmodule*/no-declare (lib) (t "The bindings documented in this section are provided by the " (schememodname lib) " and " - (schememodname scheme/init) + (schememodname racket/init) " libraries, which means that they are available when " - (exec "mzscheme") " is started with no command-line arguments." - " They are not provided by " (schememodname scheme/base) - " or " (schememodname scheme) "." + (exec "racket") " is started with no command-line arguments." + " They are not provided by " (schememodname racket/base) + " or " (schememodname racket) "." . more)))] [(_ lib . more) (note-init-lib lib #:use-sources () . more)])) @@ -72,8 +72,8 @@ (defmodule lib #:use-sources (src ...) (t "The bindings documented in this section are provided by the " (schememodname lib) - " library, not " (schememodname scheme/base) - " or " (schememodname scheme) + " library, not " (schememodname racket/base) + " or " (schememodname racket) "." . more))] [(_ lib . more) diff --git a/collects/scribblings/reference/namespaces.scrbl b/collects/scribblings/reference/namespaces.scrbl index 313dfcad0b..83ea9d0ad8 100644 --- a/collects/scribblings/reference/namespaces.scrbl +++ b/collects/scribblings/reference/namespaces.scrbl @@ -30,7 +30,7 @@ with @scheme[namespace-attach-module].} @defproc[(make-base-empty-namespace) namespace?]{ -Creates a new empty namespace, but with @schememodname[scheme/base] +Creates a new empty namespace, but with @schememodname[racket/base] attached. The namespace's @tech{base phase} is the same as the @tech{phase} in which the @scheme[make-base-empty-namespace] function was created.} @@ -38,7 +38,7 @@ function was created.} @defproc[(make-base-namespace) namespace?]{ -Creates a new namespace with @schememodname[scheme/base] attached and +Creates a new namespace with @schememodname[racket/base] attached and @scheme[require]d into the top-level environment. The namespace's @tech{base phase} is the same as the @tech{phase} in which the @scheme[make-base-namespace] function was created.} diff --git a/collects/scribblings/reference/networking.scrbl b/collects/scribblings/reference/networking.scrbl index 564bfcd8c3..87cfdcd203 100644 --- a/collects/scribblings/reference/networking.scrbl +++ b/collects/scribblings/reference/networking.scrbl @@ -8,7 +8,7 @@ @;------------------------------------------------------------------------ @section[#:tag "tcp"]{TCP} -@note-lib[scheme/tcp] +@note-lib[racket/tcp] For information about TCP in general, see @italic{TCP/IP Illustrated, Volume 1} by W. Richard Stevens. @@ -257,7 +257,7 @@ port returned by @scheme[tcp-accept], @scheme[tcp-connect], @;------------------------------------------------------------------------ @section[#:tag "udp"]{UDP} -@note-lib[scheme/udp] +@note-lib[racket/udp] For information about UDP in general, see @italic{TCP/IP Illustrated, Volume 1} by W. Richard Stevens. diff --git a/collects/scribblings/reference/numbers.scrbl b/collects/scribblings/reference/numbers.scrbl index 7bb3a20d7a..0498d27caa 100644 --- a/collects/scribblings/reference/numbers.scrbl +++ b/collects/scribblings/reference/numbers.scrbl @@ -1,15 +1,15 @@ #lang scribble/doc @(require "mz.ss" - scheme/math + racket/math scribble/extract - (for-label scheme/math - scheme/flonum - scheme/fixnum - scheme/unsafe/ops - scheme/require)) + (for-label racket/math + racket/flonum + racket/fixnum + racket/unsafe/ops + racket/require)) @(define math-eval (make-base-eval)) -@(interaction-eval #:eval math-eval (require scheme/math)) +@(interaction-eval #:eval math-eval (require racket/math)) @title[#:tag "numbers"]{Numbers} @@ -70,7 +70,7 @@ infinity, or @scheme[+nan.0] if no such limit exists. A @deftech{fixnum} is an exact integer whose two's complement representation fit into 31 bits on a 32-bit platform or 63 bits on a 64-bit platform; furthermore, no allocation is required when computing -with fixnums. See also the @schememodname[scheme/fixnum] module, below. +with fixnums. See also the @schememodname[racket/fixnum] module, below. Two fixnums that are @scheme[=] are also the same according to @scheme[eq?]. Otherwise, the result of @scheme[eq?] @@ -875,9 +875,9 @@ is little-endian.} @; ------------------------------------------------------------------------ @section{Inexact-Real (Flonum) Operations} -@defmodule[scheme/flonum] +@defmodule[racket/flonum] -The @schememodname[scheme/flonum] library provides operations like +The @schememodname[racket/flonum] library provides operations like @scheme[fl+] that consume and produce only real @tech{inexact numbers}, which are also known as @deftech{flonums}. Flonum-specific operations provide can better performance when used consistently, and @@ -953,10 +953,10 @@ so the result is always a @tech{flonum}. A @deftech{flvector} is like a @tech{vector}, but it holds only inexact real numbers. This representation can be more compact, and unsafe operations on @tech{flvector}s (see -@schememodname[scheme/unsafe/ops]) can execute more efficiently than +@schememodname[racket/unsafe/ops]) can execute more efficiently than unsafe operations on @tech{vectors} of inexact reals. -An f64vector as provided by @schememodname[scheme/foreign] stores the +An f64vector as provided by @schememodname[racket/unsafe/ffi] stores the same kinds of values as an @tech{flvector}, but with extra indirections that make f64vectors more convenient for working with foreign libraries. The lack of indirections make unsafe @@ -1005,25 +1005,25 @@ first slot is position @scheme[0], and the last slot is one less than @section{Fixnum Operations} -@defmodule[scheme/fixnum] +@defmodule[racket/fixnum] -The @schememodname[scheme/fixnum] library provides operations like +The @schememodname[racket/fixnum] library provides operations like @scheme[fx+] that consume and produce only fixnums. The operations in this library are meant to be safe versions of unsafe operations like @scheme[unsafe-fx+]. These safe operations are generally no faster than using generic primitives like @scheme[+]. -The expected use of the @schememodname[scheme/fixnum] library is for -code where the @scheme[require] of @schememodname[scheme/fixnum] is +The expected use of the @schememodname[racket/fixnum] library is for +code where the @scheme[require] of @schememodname[racket/fixnum] is replaced with @schemeblock[(require (filtered-in (λ (name) (regexp-replace #rx"unsafe-" name "")) - scheme/unsafe/ops))] + racket/unsafe/ops))] to drop in unsafe versions of the library. Alternately, when encountering crashes with code that uses unsafe fixnum operations, use -the @schememodname[scheme/fixnum] library to help debug the problems. +the @schememodname[racket/fixnum] library to help debug the problems. @deftogether[( @defproc[(fx+ [a fixnum?][b fixnum?]) fixnum?] @@ -1078,7 +1078,7 @@ Safe versions of @scheme[unsafe-fx=], @scheme[unsafe-fx<], @; ------------------------------------------------------------------------ @section{Extra Constants and Functions} -@note-lib[scheme/math] +@note-lib[racket/math] @defthing[pi real]{ diff --git a/collects/scribblings/reference/package.scrbl b/collects/scribblings/reference/package.scrbl index 9b56433a6c..3b8324bd15 100644 --- a/collects/scribblings/reference/package.scrbl +++ b/collects/scribblings/reference/package.scrbl @@ -1,13 +1,13 @@ #lang scribble/doc @(require "mz.ss" - (for-label scheme/package)) + (for-label racket/package)) @(define pack-eval (make-base-eval)) -@interaction-eval[#:eval pack-eval (require scheme/package)] +@interaction-eval[#:eval pack-eval (require racket/package)] @title[#:tag "package"]{Limiting Scope: @scheme[define-package], @scheme[open-package], ...} -@note-lib-only[scheme/package] +@note-lib-only[racket/package] @deftogether[( @defform[(define-package package-id exports form ...)] @@ -129,7 +129,7 @@ cookies The @scheme[package?], @scheme[package-exported-identifiers], and @scheme[package-original-identifiers] functions are exported -@scheme[for-syntax] by @schememodname[scheme/package]. +@scheme[for-syntax] by @schememodname[racket/package]. The @scheme[package?] predicate returns @scheme[#t] if @scheme[v] is a package value as obtained by @scheme[syntax-local-value] on an diff --git a/collects/scribblings/reference/pairs.scrbl b/collects/scribblings/reference/pairs.scrbl index 8851966cb5..e89b37938d 100644 --- a/collects/scribblings/reference/pairs.scrbl +++ b/collects/scribblings/reference/pairs.scrbl @@ -1,9 +1,9 @@ #lang scribble/doc @(require "mz.ss" scribble/scheme - scheme/generator - scheme/list - (for-syntax scheme/base)) + racket/generator + racket/list + (for-syntax racket/base)) @(define (generate-c_r-example proc) (define (make-it start n) @@ -648,10 +648,10 @@ Like @scheme[assoc], but finds an element using the predicate @; ---------------------------------------- @section{Additional List Functions and Synonyms} -@note-lib[scheme/list] +@note-lib[racket/list] @(define list-eval (make-base-eval)) @(interaction-eval #:eval list-eval - (require scheme/list (only-in scheme/function negate))) + (require racket/list (only-in racket/function negate))) @defthing[empty null?]{The empty list. @mz-examples[#:eval list-eval diff --git a/collects/scribblings/reference/paths.scrbl b/collects/scribblings/reference/paths.scrbl index 3c2f050953..b61a29285b 100644 --- a/collects/scribblings/reference/paths.scrbl +++ b/collects/scribblings/reference/paths.scrbl @@ -256,7 +256,7 @@ Windows examples. (build-path p2 p1) (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{Unix: is @scheme["/home/joeuser/src/racket/../../docs/Scheme"]}) (code:comment @#,t{Windows: is @scheme["C:\\Joe's Files\\src\\scheme\\..\\..\\docs\\Scheme"]}) ]} @@ -496,7 +496,7 @@ to the end.} @;------------------------------------------------------------------------ @section{More Path Utilities} -@note-lib[scheme/path] +@note-lib[racket/path] @defproc[(explode-path [path (or/c path-string? path-for-some-system?)]) (listof (or/c path-for-some-system? 'up 'same))]{ diff --git a/collects/scribblings/reference/port-lib.scrbl b/collects/scribblings/reference/port-lib.scrbl index 76113cafb2..867cea28d9 100644 --- a/collects/scribblings/reference/port-lib.scrbl +++ b/collects/scribblings/reference/port-lib.scrbl @@ -1,10 +1,10 @@ #lang scribble/doc @(require "mz.ss" - (for-label scheme/port)) + (for-label racket/port)) @title[#:tag "port-lib"]{More Port Constructors, Procedures, and Events} -@note-lib[scheme/port] +@note-lib[racket/port] @; ---------------------------------------------------------------------- diff --git a/collects/scribblings/reference/pretty-print.scrbl b/collects/scribblings/reference/pretty-print.scrbl index b774eb3ec0..87ccb506e9 100644 --- a/collects/scribblings/reference/pretty-print.scrbl +++ b/collects/scribblings/reference/pretty-print.scrbl @@ -4,7 +4,7 @@ @title[#:tag "pretty-print"]{Pretty Printing} -@note-lib[scheme/pretty] +@note-lib[racket/pretty] @defproc[(pretty-print [v any/c] [port output-port? (current-output-port)]) void?]{ diff --git a/collects/scribblings/reference/procedures.scrbl b/collects/scribblings/reference/procedures.scrbl index ecf93afbf5..45ecd60263 100644 --- a/collects/scribblings/reference/procedures.scrbl +++ b/collects/scribblings/reference/procedures.scrbl @@ -453,7 +453,7 @@ and @scheme[v2], and its result is returned by A @idefterm{primitive procedure} is a built-in procedure that is implemented in low-level language. Not all procedures of -@schememodname[scheme/base] are primitives, but many are. The +@schememodname[racket/base] are primitives, but many are. The distinction is mainly useful to other low-level code. @defproc[(primitive? [v any/c]) boolean?]{ @@ -479,9 +479,9 @@ applied.} @; ---------------------------------------- @section{Additional Procedure Functions} -@note-lib[scheme/function] +@note-lib[racket/function] @(define fun-eval (make-base-eval)) -@(interaction-eval #:eval fun-eval (require scheme/function)) +@(interaction-eval #:eval fun-eval (require racket/function)) @defproc[(const [v any]) procedure?]{ diff --git a/collects/scribblings/reference/promise.scrbl b/collects/scribblings/reference/promise.scrbl index 9864531d29..c71cc43498 100644 --- a/collects/scribblings/reference/promise.scrbl +++ b/collects/scribblings/reference/promise.scrbl @@ -1,10 +1,10 @@ #lang scribble/doc @(require "mz.ss" - (for-label scheme/promise)) + (for-label racket/promise)) @title{Delayed Evaluation} -@note-lib[scheme/promise] +@note-lib[racket/promise] A @deftech{promise} encapsulates an expression to be evaluated on demand via @scheme[force]. After a promise has been @scheme[force]d, diff --git a/collects/scribblings/reference/reader-example.ss b/collects/scribblings/reference/reader-example.ss index 05be75aa9d..32b96046fe 100644 --- a/collects/scribblings/reference/reader-example.ss +++ b/collects/scribblings/reference/reader-example.ss @@ -1,10 +1,10 @@ -(module reader-example scheme/base +(module reader-example racket/base (require scribble/struct scribble/decode scribble/manual scribble/scheme - scheme/class) + racket/class) (provide reader-examples read-quote-table diff --git a/collects/scribblings/reference/reference.scrbl b/collects/scribblings/reference/reference.scrbl index 8413d4971a..b59d76cb47 100644 --- a/collects/scribblings/reference/reference.scrbl +++ b/collects/scribblings/reference/reference.scrbl @@ -4,7 +4,7 @@ scribble/html-properties scribble/latex-properties scribble/core - scheme/list) + racket/list) @(define (scheme-extra-libs) (make-delayed-element @@ -25,16 +25,16 @@ (make-css-addition "extras.css") (make-tex-addition "extras.tex")))) -@title[#:style (extras)]{@bold{Reference}: PLT Scheme} +@title[#:style (extras)]{@bold{Reference}: Racket} @author["Matthew Flatt" "PLT"] -This manual defines the core PLT Scheme language and describes its +This manual defines the core Racket language and describes its most prominent libraries. The companion manual @|Guide| provides a friendlier (though less precise and less complete) overview of the language. -@defmodulelang*[(scheme/base scheme) +@defmodulelang*[(racket/base racket) ;; Use sources for overlap with `mzscheme': #:use-sources ('#%kernel racket/private/more-scheme @@ -44,14 +44,15 @@ language. racket/private/letstx-scheme racket/private/define racket/private/stx - racket/private/map)]{ + racket/private/map + racket/private/base)]{ Unless otherwise noted, the bindings defined in this manual are -exported by the @schememodname[scheme/base] and @schememodname[scheme] +exported by the @schememodname[racket/base] and @schememodname[racket] languages.} -@margin-note{The @schememodname[scheme] library combines -@schememodname[scheme/base]@scheme-extra-libs[].} +@margin-note{The @schememodname[racket] library combines +@schememodname[racket/base]@scheme-extra-libs[].} @table-of-contents[] diff --git a/collects/scribblings/reference/sandbox.scrbl b/collects/scribblings/reference/sandbox.scrbl index 7148aea2e2..9db038dbdc 100644 --- a/collects/scribblings/reference/sandbox.scrbl +++ b/collects/scribblings/reference/sandbox.scrbl @@ -2,9 +2,9 @@ @(require "mz.ss" scheme/sandbox (for-label scheme/sandbox - scheme/port - (only-in scheme/gui make-gui-namespace) - scheme/gui/dynamic)) + racket/port + (only-in racket/gui make-gui-namespace) + racket/gui/dynamic)) @(define box-eval (make-base-eval)) @(interaction-eval #:eval box-eval (require scheme/sandbox)) @@ -138,9 +138,9 @@ top-level namespace: #:eval box-eval (define base-module-eval (code:comment @#,t{a module cannot have free variables...}) - (make-evaluator 'scheme/base '(define (f) later))) + (make-evaluator 'racket/base '(define (f) later))) (define base-module-eval - (make-evaluator 'scheme/base '(define (f) later) + (make-evaluator 'racket/base '(define (f) later) '(define later 5))) (base-module-eval '(f)) @@ -163,7 +163,7 @@ restriction is enforced). @schemeblock[ (define base-module-eval2 (code:comment @#,t{equivalent to @scheme[base-module-eval]:}) - (make-module-evaluator '(module m scheme/base + (make-module-evaluator '(module m racket/base (define (f) later) (define later 5)))) ] @@ -201,7 +201,7 @@ calls to a single evaluator. Usually this is not a problem, but in some cases you can get the evaluator function available inside the sandboxed code, for example: @schemeblock[ -(let ([e (make-evaluator 'scheme/base)]) +(let ([e (make-evaluator 'racket/base)]) (e (,e 1))) ] An error will be signalled in such cases. @@ -220,7 +220,7 @@ that you can easily start a sandboxed read-eval-print-loop. For example, here is a quick implementation of a networked REPL: @schemeblock[ -(define e (make-evaluator 'scheme/base)) +(define e (make-evaluator 'racket/base)) (let-values ([(i o) (tcp-accept (tcp-listen 9999))]) (parameterize ([current-input-port i] [current-output-port o] @@ -250,7 +250,7 @@ used from a module (by using a new namespace): [sandbox-error-output o] [current-namespace (make-empty-namespace)]) (parameterize ([current-eval - (make-evaluator 'scheme/base)]) + (make-evaluator 'racket/base)]) (read-eval-print-loop)) (fprintf o "\nBye...\n") (close-output-port o))) @@ -571,7 +571,7 @@ with the per-expression limit specified by sandbox, as well as from the interaction will count against the sandbox limit. For example, in the last interaction of this code, @schemeblock[ - (define e (make-evaluator 'scheme/base)) + (define e (make-evaluator 'racket/base)) (e '(define a 1)) (e '(for ([i (in-range 20)]) (set! a (cons (make-bytes 500000) a)))) ] @@ -598,11 +598,11 @@ per-evaluation limits (useful in case more limit kinds are available in future versions). The default is @scheme[(list 30 20)]. Note that these limits apply to the creation of the sandbox -environment too --- even @scheme[(make-evaluator 'scheme/base)] can +environment too --- even @scheme[(make-evaluator 'racket/base)] can fail if the limits are strict enough. For example, @schemeblock[ (parameterize ([sandbox-eval-limits '(0.25 5)]) - (make-evaluator 'scheme/base '(sleep 2))) + (make-evaluator 'racket/base '(sleep 2))) ] will throw an error instead of creating an evaluator. Therefore, to avoid surprises you need to catch errors that happen when the sandbox @@ -878,7 +878,7 @@ your own permissions, for example, @defthing[gui? boolean?]{ -True if the @schememodname[scheme/gui] module can be used, @scheme[#f] +True if the @schememodname[racket/gui] module can be used, @scheme[#f] otherwise; see @scheme[gui-available?]. Various aspects of the @schememodname[scheme/sandbox] library change diff --git a/collects/scribblings/reference/sequences.scrbl b/collects/scribblings/reference/sequences.scrbl index f3bd9ced66..5a97e8fb84 100644 --- a/collects/scribblings/reference/sequences.scrbl +++ b/collects/scribblings/reference/sequences.scrbl @@ -1,13 +1,13 @@ #lang scribble/doc @(require "mz.ss" - (for-syntax scheme/base) + (for-syntax racket/base) scribble/scheme - (for-label scheme/generator)) + (for-label racket/generator)) @(define generator-eval (lambda () (let ([the-eval (make-base-eval)]) - (the-eval '(require scheme/generator)) + (the-eval '(require racket/generator)) the-eval))) @(define (info-on-seq where what) @@ -324,7 +324,7 @@ sequence; if no more elements are available, the @exnraise[exn:fail:contract].} @section{Iterator Generators} -@defmodule[scheme/generator] +@defmodule[racket/generator] @defform[(generator () body ...)]{ Creates a function that returns a value through @scheme[yield], each time it is invoked. When the generator runs out of values to yield, the last value it computed diff --git a/collects/scribblings/reference/serialization.scrbl b/collects/scribblings/reference/serialization.scrbl index 1361df1d72..e1e32b8944 100644 --- a/collects/scribblings/reference/serialization.scrbl +++ b/collects/scribblings/reference/serialization.scrbl @@ -1,14 +1,14 @@ #lang scribble/doc @(require "mz.ss" - scheme/serialize - (for-label scheme/serialize)) + racket/serialize + (for-label racket/serialize)) @(define ser-eval (make-base-eval)) -@(interaction-eval #:eval ser-eval (require scheme/serialize)) +@(interaction-eval #:eval ser-eval (require racket/serialize)) @title[#:tag "serialization"]{Serialization} -@note-lib-only[scheme/serialize #:use-sources (racket/private/serialize)] +@note-lib-only[racket/serialize #:use-sources (racket/private/serialize)] @defproc[(serializable? [v any/c]) boolean?]{ diff --git a/collects/scribblings/reference/sets.scrbl b/collects/scribblings/reference/sets.scrbl index 88e3b1cb99..2069cf3ca7 100644 --- a/collects/scribblings/reference/sets.scrbl +++ b/collects/scribblings/reference/sets.scrbl @@ -1,6 +1,6 @@ #lang scribble/doc @(require "mz.ss" - (for-label scheme/set)) + (for-label racket/set)) @title[#:tag "sets"]{Sets} @@ -16,7 +16,7 @@ unpredictable in much the same way that @tech{hash table} operations are unpredictable when keys are mutated. -@note-lib-only[scheme/set] +@note-lib[racket/set] @defproc[(set? [v any/c]) boolean?]{ diff --git a/collects/scribblings/reference/shared.scrbl b/collects/scribblings/reference/shared.scrbl index 32c00b3e05..24c98641dc 100644 --- a/collects/scribblings/reference/shared.scrbl +++ b/collects/scribblings/reference/shared.scrbl @@ -1,12 +1,12 @@ #lang scribble/doc @(require "mz.ss" scribble/struct - scheme/shared - (for-label scheme/shared)) + racket/shared + (for-label racket/shared)) @(define shared-eval (make-base-eval)) -@(interaction-eval #:eval shared-eval (require scheme/shared)) +@(interaction-eval #:eval shared-eval (require racket/shared)) @(define maker (make-element #f (list @@ -20,7 +20,7 @@ @title[#:tag "shared"]{Constructing Graphs: @scheme[shared]} -@note-lib[scheme/shared] +@note-lib[racket/shared] @defform[(shared ([id expr] ...) body ...+)]{ diff --git a/collects/scribblings/reference/splicing.scrbl b/collects/scribblings/reference/splicing.scrbl index 24ada5054b..491619e6dd 100644 --- a/collects/scribblings/reference/splicing.scrbl +++ b/collects/scribblings/reference/splicing.scrbl @@ -1,17 +1,17 @@ #lang scribble/doc @(require "mz.ss" - (for-label scheme/splicing - scheme/stxparam - scheme/local)) + (for-label racket/splicing + racket/stxparam + racket/local)) @(define splice-eval (make-base-eval)) -@interaction-eval[#:eval splice-eval (require scheme/splicing - scheme/stxparam - (for-syntax scheme/base))] +@interaction-eval[#:eval splice-eval (require racket/splicing + racket/stxparam + (for-syntax racket/base))] @title[#:tag "splicing"]{Local Binding with Splicing Body} -@note-lib-only[scheme/splicing] +@note-lib-only[racket/splicing] @deftogether[( @defidform[splicing-let] diff --git a/collects/scribblings/reference/startup.scrbl b/collects/scribblings/reference/startup.scrbl index 5253636d7b..b4c0091186 100644 --- a/collects/scribblings/reference/startup.scrbl +++ b/collects/scribblings/reference/startup.scrbl @@ -1,8 +1,8 @@ #lang scribble/doc @(require "mz.ss" scribble/bnf - (for-label scheme/pretty - scheme/gui/base)) + (for-label racket/pretty + racket/gui/base)) @(define (FlagFirst n) (as-index (Flag n))) @(define (DFlagFirst n) (as-index (DFlag n))) @@ -21,13 +21,13 @@ The core PLT Scheme run-time system is available in two main variants: @itemize[ @item{MzScheme, which provides the primitives libraries on which - @schememodname[scheme/base] is implemented. Under Unix and Mac + @schememodname[racket/base] is implemented. Under Unix and Mac OS X, the executable is called @as-index{@exec{mzscheme}}. Under Windows, the executable is called @as-index{@exec{MzScheme.exe}}.} @item{MrEd, which extends @exec{mzscheme} with GUI primitives on - which @schememodname[scheme/gui/base] is implemented. Under + which @schememodname[racket/gui/base] is implemented. Under Unix, the executable is called @as-index{@exec{mred}}. Under Windows, the executable is called @as-index{@exec{MrEd.exe}}. Under Mac OS X, the @exec{mred} @@ -44,8 +44,8 @@ On startup, the top-level environment contains no bindings---not even that start with @schemeidfont{#%} are defined, but they are not meant for direct use, and the set of such modules can change. For example, the @indexed-scheme['#%kernel] module is eventually used to bootstrap -the implemetation of @schememodname[scheme/base], and -@scheme['#%mred-kernel] is used for @schememodname[scheme/gui/base]. +the implemetation of @schememodname[racket/base], and +@scheme['#%mred-kernel] is used for @schememodname[racket/gui/base]. The first action of MzScheme or MrEd is to initialize @scheme[current-library-collection-paths] to the result of @@ -55,8 +55,8 @@ are extra directory paths provided in order in the command line with @Flag{S}/@DFlag{search}. An executable created from the MzScheme or MrEd executable can embed paths used as @scheme[_pre-extras]. -MzScheme and MrEd next @scheme[require] @schememodname[scheme/init] -and @schememodname[scheme/gui/init], respectively, but only if the +MzScheme and MrEd next @scheme[require] @schememodname[racket/init] +and @schememodname[racket/gui/init], respectively, but only if the command line does not specify a @scheme[require] flag (@Flag{t}/@DFlag{require}, @Flag{l}/@DFlag{lib}, or @Flag{u}/@DFlag{require-script}) before any @scheme[eval], @@ -199,8 +199,8 @@ flags: instead of @scheme[graphical-read-eval-print-loop].} @item{@FlagFirst{n} or @DFlagFirst{no-lib} : Skips requiring the - initialization library (i.e., @schememodname[scheme/init] or - @schememodname[scheme/gui/init], unless it is changed with the + initialization library (i.e., @schememodname[racket/init] or + @schememodname[racket/gui/init], unless it is changed with the @Flag{I} flag) when not otherwise disabled.} @item{@FlagFirst{v} or @DFlagFirst{version} : Shows @@ -399,7 +399,7 @@ language specifies run-time configuration by ] -The @schememodname[scheme/base] and @schememodname[scheme] languages +The @schememodname[racket/base] and @schememodname[scheme] languages do not currently specify a run-time configuration action. A @scheme['configure-runtime] query returns a list of vectors, instead diff --git a/collects/scribblings/reference/strings.scrbl b/collects/scribblings/reference/strings.scrbl index 020caddb3c..54e082caf8 100644 --- a/collects/scribblings/reference/strings.scrbl +++ b/collects/scribblings/reference/strings.scrbl @@ -364,9 +364,9 @@ allocated string).} @; ---------------------------------------- @section{Additional String Functions} -@note-lib[scheme/string] +@note-lib[racket/string] @(define string-eval (make-base-eval)) -@(interaction-eval #:eval string-eval (require scheme/string scheme/list)) +@(interaction-eval #:eval string-eval (require racket/string racket/list)) @defproc[(string-append* [str string?] ... [strs (listof string?)]) string?]{ @; Note: this is exactly the same description as the one for append* diff --git a/collects/scribblings/reference/struct.scrbl b/collects/scribblings/reference/struct.scrbl index 87dd20b8e6..b5dc9e4a06 100644 --- a/collects/scribblings/reference/struct.scrbl +++ b/collects/scribblings/reference/struct.scrbl @@ -1,6 +1,6 @@ #lang scribble/doc @(require "mz.ss" - (for-label scheme/struct-info)) + (for-label racket/struct-info)) @(define struct-eval (make-base-eval)) @@ -628,7 +628,7 @@ imported structure type, in which case the user is expected to know the set of fields that are listed in the signature for the structure type. -@note-lib-only[scheme/struct-info] +@note-lib-only[racket/struct-info] @defproc[(struct-info? [v any/c]) boolean?]{ diff --git a/collects/scribblings/reference/stx-param.scrbl b/collects/scribblings/reference/stx-param.scrbl index 638b3475d7..c0abf2d276 100644 --- a/collects/scribblings/reference/stx-param.scrbl +++ b/collects/scribblings/reference/stx-param.scrbl @@ -1,12 +1,12 @@ #lang scribble/doc @(require "mz.ss" - (for-label scheme/stxparam - scheme/stxparam-exptime - scheme/splicing)) + (for-label racket/stxparam + racket/stxparam-exptime + racket/splicing)) @title[#:tag "stxparam"]{Syntax Parameters} -@note-lib-only[scheme/stxparam] +@note-lib-only[racket/stxparam] @defform[(define-syntax-parameter id expr)]{ @@ -49,9 +49,9 @@ the target's value.} @section{Syntax Parameter Inspection} -@defmodule*/no-declare[(scheme/stxparam-exptime)] +@defmodule*/no-declare[(racket/stxparam-exptime)] -@declare-exporting[scheme/stxparam-exptime scheme/stxparam] +@declare-exporting[racket/stxparam-exptime racket/stxparam] @defproc[(syntax-parameter-value [id-stx syntax?]) any]{ @@ -62,9 +62,9 @@ value of the @tech{syntax parameter}, as adjusted by @scheme[syntax-parameterize] form. This binding is provided @scheme[for-syntax] by -@schememodname[scheme/stxparam], since it is normally used in a +@schememodname[racket/stxparam], since it is normally used in a transformer. It is provided normally by -@schememodname[scheme/stxparam-exptime].} +@schememodname[racket/stxparam-exptime].} @defproc[(make-parameter-rename-transformer [id-stx syntax?]) any]{ @@ -87,6 +87,6 @@ treated specially by @scheme[syntax-local-value], unlike the result of @scheme[make-rename-transformer]. This binding is provided @scheme[for-syntax] by -@schememodname[scheme/stxparam], since it is normally used in a +@schememodname[racket/stxparam], since it is normally used in a transformer. It is provided normally by -@schememodname[scheme/stxparam-exptime].} +@schememodname[racket/stxparam-exptime].} diff --git a/collects/scribblings/reference/stx-patterns.scrbl b/collects/scribblings/reference/stx-patterns.scrbl index e646968916..47258e99ff 100644 --- a/collects/scribblings/reference/stx-patterns.scrbl +++ b/collects/scribblings/reference/stx-patterns.scrbl @@ -6,7 +6,7 @@ @(define syntax-eval (lambda () (let ([the-eval (make-base-eval)]) - (the-eval '(require (for-syntax scheme/base))) + (the-eval '(require (for-syntax racket/base))) the-eval))) @title[#:tag "stx-patterns"]{Pattern-Based Syntax Matching} @@ -80,9 +80,9 @@ A syntax object matches a @scheme[pattern] as follows: @specsubform[(pattern ...+ . pattern)]{ - The last @scheme[pattern] must not be a @scheme/form[(pattern ...)], - @scheme/form[(pattern ...+ . pattern)], @scheme/form[(pattern ... pattern - ellipses pattern ...)], or @scheme/form[(pattern ... pattern ellipses + The last @scheme[pattern] must not be a @racket/form[(pattern ...)], + @racket/form[(pattern ...+ . pattern)], @racket/form[(pattern ... pattern + ellipses pattern ...)], or @racket/form[(pattern ... pattern ellipses pattern ... . pattern)] form. Like the previous kind of pattern, but matches syntax objects that @@ -155,7 +155,7 @@ A syntax object matches a @scheme[pattern] as follows: @scheme[const].} @mz-examples[ -(require (for-syntax scheme/base)) +(require (for-syntax racket/base)) (define-syntax (swap stx) (syntax-case stx () [(_ a b) #'(let ([t a]) @@ -490,4 +490,4 @@ get the identifier's transformer value, and then test the value with @scheme[syntax-pattern-variable?]. The @scheme[syntax-pattern-variable?] procedure is provided -@scheme[for-syntax] by @schememodname[scheme/base].} +@scheme[for-syntax] by @schememodname[racket/base].} diff --git a/collects/scribblings/reference/stx-trans.scrbl b/collects/scribblings/reference/stx-trans.scrbl index d27fc01054..7cbb15fdd4 100644 --- a/collects/scribblings/reference/stx-trans.scrbl +++ b/collects/scribblings/reference/stx-trans.scrbl @@ -1,13 +1,13 @@ #lang scribble/doc @(require (except-in "mz.ss" import export) - (for-syntax scheme/base) - (for-label scheme/require-transform - scheme/require-syntax - scheme/provide-transform - scheme/provide-syntax)) + (for-syntax racket/base) + (for-label racket/require-transform + racket/require-syntax + racket/provide-transform + racket/provide-syntax)) @(define stx-eval (make-base-eval)) -@(interaction-eval #:eval stx-eval (require (for-syntax scheme/base))) +@(interaction-eval #:eval stx-eval (require (for-syntax racket/base))) @(define (transform-time) @t{This procedure must be called during the dynamic extent of a @tech{syntax transformer} application by the @@ -766,7 +766,7 @@ identifier.} @section[#:tag "require-trans"]{@scheme[require] Transformers} -@note-lib-only[scheme/require-transform] +@note-lib-only[racket/require-transform] A @tech{transformer binding} whose value is a structure with the @scheme[prop:require-transformer] property implements a derived @@ -890,7 +890,7 @@ necessary to expand it.} @section[#:tag "provide-trans"]{@scheme[provide] Transformers} -@note-lib-only[scheme/provide-transform] +@note-lib-only[racket/provide-transform] A @tech{transformer binding} whose value is a structure with the @scheme[prop:provide-transformer] property implements a derived diff --git a/collects/scribblings/reference/subprocess.scrbl b/collects/scribblings/reference/subprocess.scrbl index 8de58c04b5..b8b083ad3e 100644 --- a/collects/scribblings/reference/subprocess.scrbl +++ b/collects/scribblings/reference/subprocess.scrbl @@ -1,6 +1,6 @@ #lang scribble/doc @(require "mz.ss" - (for-label scheme/system)) + (for-label racket/system)) @title[#:tag "subprocess"]{Processes} @@ -26,7 +26,7 @@ Creates a new process in the underlying operating system to execute @scheme[command] asynchronously. See also @scheme[system] and -@scheme[process] from @schememodname[scheme/system]. +@scheme[process] from @schememodname[racket/system]. The @scheme[command] argument is a path to a program executable, and the @scheme[arg]s are command-line arguments for the program. Under @@ -226,7 +226,7 @@ real process ID). @section{Simple Subprocesses} -@note-lib-only[scheme/system] +@note-lib-only[racket/system] @defproc[(system [command string?]) boolean?]{ diff --git a/collects/scribblings/reference/surrogate.scrbl b/collects/scribblings/reference/surrogate.scrbl index bc57f9fd16..5c6a664b29 100644 --- a/collects/scribblings/reference/surrogate.scrbl +++ b/collects/scribblings/reference/surrogate.scrbl @@ -1,13 +1,13 @@ #lang scribble/doc @(require "mz.ss" - (for-label scheme/surrogate - scheme/class)) + (for-label racket/surrogate + racket/class)) @title{Surrogates} -@note-lib-only[scheme/surrogate] +@note-lib-only[racket/surrogate] -The @schememodname[scheme/surrogate] library provides an abstraction +The @schememodname[racket/surrogate] library provides an abstraction for building an instance of the @deftech{proxy design pattern}. The pattern consists of two objects, a @defterm{host} and a @defterm{surrogate} object. The host object delegates method calls to diff --git a/collects/scribblings/reference/syntax-model.scrbl b/collects/scribblings/reference/syntax-model.scrbl index 8db0e3534e..ed9f3a481d 100644 --- a/collects/scribblings/reference/syntax-model.scrbl +++ b/collects/scribblings/reference/syntax-model.scrbl @@ -4,7 +4,7 @@ "mz.ss") @(define scheme-eval (make-base-eval)) -@(interaction-eval #:eval scheme-eval (require (for-syntax scheme/base))) +@(interaction-eval #:eval scheme-eval (require (for-syntax racket/base))) @;------------------------------------------------------------------------ @title[#:tag "syntax-model"]{Syntax Model} @@ -117,7 +117,7 @@ other information. For example, a @schemeidfont{car} @tech{identifier} might have @tech{lexical information} that designates it as the @scheme[car] from -the @schememodname[scheme/base] language (i.e., the built-in +the @schememodname[racket/base] language (i.e., the built-in @scheme[car]). Similarly, a @schemeidfont{lambda} identifier's @tech{lexical information} may indicate that it represents a procedure form. Some other @tech{identifier}'s @tech{lexical information} may @@ -239,7 +239,7 @@ is significant. For example, the second case for @scheme[_expr] is a @tech{syntax-object} list whose first element is an @tech{identifier}, where the @tech{identifier}'s @tech{lexical information} specifies a binding to the @scheme[#%plain-lambda] of the -@schememodname[scheme/base] language (i.e., the @tech{identifier} is +@schememodname[racket/base] language (i.e., the @tech{identifier} is @scheme[free-identifier=?] to one whose binding is @scheme[#%plain-lambda]). In all cases, identifiers above typeset as syntactic-form names refer to the bindings defined in diff --git a/collects/scribblings/reference/syntax.scrbl b/collects/scribblings/reference/syntax.scrbl index 94f3afeb8c..a9b7326484 100644 --- a/collects/scribblings/reference/syntax.scrbl +++ b/collects/scribblings/reference/syntax.scrbl @@ -1,24 +1,24 @@ #lang scribble/doc @(require "mz.ss" scribble/bnf - (for-label (only-in scheme/require-transform + (for-label (only-in racket/require-transform make-require-transformer) - scheme/require-syntax - scheme/require - (only-in scheme/provide-transform + racket/require-syntax + racket/require + (only-in racket/provide-transform make-provide-transformer) - scheme/provide-syntax - scheme/provide - scheme/nest - scheme/package - scheme/splicing - scheme/runtime-path)) + racket/provide-syntax + racket/provide + racket/nest + racket/package + racket/splicing + racket/runtime-path)) @(define require-eval (make-base-eval)) @(define syntax-eval (lambda () (let ([the-eval (make-base-eval)]) - (the-eval '(require (for-syntax scheme/base))) + (the-eval '(require (for-syntax racket/base))) the-eval))) @(define meta-in-eval (syntax-eval)) @@ -208,7 +208,7 @@ be preserved in marshaled bytecode. See also See also @secref["module-eval-model"] and @secref["mod-parse"]. @defexamples[#:eval (syntax-eval) -(module duck scheme/base +(module duck racket/base (provide num-eggs quack) (define num-eggs 2) (define (quack n) @@ -222,7 +222,7 @@ See also @secref["module-eval-model"] and @secref["mod-parse"]. Legal only in a @tech{module begin context}, and handled by the @scheme[module] form. -The @scheme[#%module-begin] form of @schememodname[scheme/base] wraps +The @scheme[#%module-begin] form of @schememodname[racket/base] wraps every top-level expression to print non-@|void-const| results using @scheme[current-print].} @@ -297,7 +297,7 @@ The syntax of @scheme[require-spec] can be extended via @scheme[require-spec]s are specified in a @scheme[require], the bindings of each @scheme[require-spec] are visible for expanding later @scheme[require-spec]s. The pre-defined forms (as exported by -@scheme[scheme/base]) are as follows: +@scheme[racket/base]) are as follows: @specsubform[module-path]{ Imports all exported bindings from the named module, using the export identifiers as the local identifiers. @@ -314,7 +314,7 @@ bindings of each @scheme[require-spec] are visible for expanding later error is reported. @defexamples[#:eval (syntax-eval) - (require (only-in scheme/tcp + (require (only-in racket/tcp tcp-listen (tcp-accept my-accept))) tcp-listen @@ -329,7 +329,7 @@ bindings of each @scheme[require-spec] are visible for expanding later reported. @defexamples[#:eval (syntax-eval) - (require (except-in scheme/tcp + (require (except-in racket/tcp tcp-listen)) tcp-accept tcp-listen @@ -342,7 +342,7 @@ bindings of each @scheme[require-spec] are visible for expanding later identifiers before prefixing. @defexamples[#:eval (syntax-eval) - (require (prefix-in tcp: scheme/tcp)) + (require (prefix-in tcp: racket/tcp)) tcp:tcp-accept tcp:tcp-listen ]} @@ -354,7 +354,7 @@ bindings of each @scheme[require-spec] are visible for expanding later describes, a syntax error is reported. @defexamples[#:eval (syntax-eval) - (require (rename-in scheme/tcp + (require (rename-in racket/tcp (tcp-accept accept) (tcp-listen listen))) accept @@ -365,8 +365,8 @@ bindings of each @scheme[require-spec] are visible for expanding later The union of the @scheme[require-spec]s. @defexamples[#:eval (syntax-eval) - (require (combine-in (only-in scheme/tcp tcp-accept) - (only-in scheme/tcp tcp-listen))) + (require (combine-in (only-in racket/tcp tcp-accept) + (only-in racket/tcp tcp-listen))) tcp-accept tcp-listen ]} @@ -563,7 +563,7 @@ corresponds to the default @tech{module name resolver}. @scheme[_rel-string], @scheme[id] must not contain @litchar{.}. @examples[#:eval require-eval - (eval:alts (require scheme/tcp) (void))]} + (eval:alts (require racket/tcp) (void))]} @defsubform[(file string)]{Similar to the plain @scheme[rel-string] case, but @scheme[string] is a path---possibly absolute---using the @@ -878,7 +878,7 @@ follows. (module nest2 scheme (define-for-syntax eggs 2) (provide (for-syntax eggs))) - (require (for-meta 2 scheme/base) + (require (for-meta 2 racket/base) (for-syntax 'nest2)) (define-syntax (test stx) (define-syntax (show-eggs stx) @@ -1023,7 +1023,7 @@ context of the @scheme[phaseless-spec] form.} @subsection{Additional @scheme[require] Forms} -@note-lib-only[scheme/require] +@note-lib-only[racket/require] The following forms support more complex selection and manipulation of sets of imported identifiers. @@ -1034,7 +1034,7 @@ sets of imported identifiers. expression (see @secref["regexp"]). @defexamples[#:eval (syntax-eval) -(module zoo scheme/base +(module zoo racket/base (provide tunafish swordfish blowfish monkey lizard ant) (define tunafish 1) @@ -1043,7 +1043,7 @@ sets of imported identifiers. (define monkey 4) (define lizard 5) (define ant 6)) -(require scheme/require) +(require racket/require) (require (matching-identifiers-in #rx"\\w*fish" 'zoo)) tunafish swordfish @@ -1071,7 +1071,7 @@ monkey (provide (all-from-out 'earth) (all-from-out 'mars))) -(require scheme/require) +(require racket/require) (require (subtract-in 'solar-system 'earth)) land aliens @@ -1092,8 +1092,8 @@ aliens (and (regexp-match? #rx"^[a-z-]+$" name) (regexp-replace #rx"-" (string-titlecase name) ""))) - scheme/base))] - will get the @scheme[scheme/base] bindings that match the regexp, + racket/base))] + will get the @scheme[racket/base] bindings that match the regexp, and renamed to use ``camel case.''} @defform[(path-up rel-string ...)]{ @@ -1111,16 +1111,16 @@ This form is useful in setting up a ``project environment''. For example, you can write a @filepath{config.ss} file in the root directory of your project with: @schememod[ - scheme/base - (require scheme/require-syntax (for-syntax "utils/in-here.ss")) + racket/base + (require racket/require-syntax (for-syntax "utils/in-here.ss")) ;; require form for my utilities (provide utils-in) (define-require-syntax utils-in in-here-transformer) ] and in @filepath{utils/in-here.ss} in the root: @schememod[ - scheme/base - (require scheme/runtime-path) + racket/base + (require racket/runtime-path) (provide in-here-transformer) (define-runtime-path here ".") (define (in-here-transformer stx) @@ -1132,14 +1132,14 @@ and in @filepath{utils/in-here.ss} in the root: ] Finally, you can use it via @scheme[path-up]: @schemeblock[ - (require scheme/require (path-up "config.ss") (utils-in foo))] + (require racket/require (path-up "config.ss") (utils-in foo))] Note that the order of requires in this form is important, as each of the first two bind the identifier used in the following. An alternative in this scenario is to use @scheme[path-up] directly to get to the utility module: @schemeblock[ - (require scheme/require (path-up "utils/foo.ss"))] + (require racket/require (path-up "utils/foo.ss"))] but then you need to be careful with subdirectories that are called @filepath{utils}, which will override the one in the project's root. In other words, the previous method requires a single unique name.} @@ -1148,7 +1148,7 @@ In other words, the previous method requires a single unique name.} @subsection{Additional @scheme[provide] Forms} -@note-lib-only[scheme/provide] +@note-lib-only[racket/provide] @defform[(matching-identifiers-out regexp provide-spec)]{ Like @scheme[provide-spec], but including only exports of bindings with @@ -1694,7 +1694,7 @@ See also @scheme[local], which supports local bindings with @;------------------------------------------------------------------------ @section[#:tag "local"]{Local Definitions: @scheme[local]} -@note-lib[scheme/local] +@note-lib[racket/local] @defform[(local [definition ...] body ...+)]{ @@ -2073,7 +2073,7 @@ bound (at @tech{phase level} 1).} @subsection[#:tag "require-syntax"]{@scheme[require] Macros} -@note-lib-only[scheme/require-syntax] +@note-lib-only[racket/require-syntax] @defform*[[(define-require-syntax id expr) (define-require-syntax (id args ...) body ...+)]]{ @@ -2095,7 +2095,7 @@ expands to a definition of the first form where the @scheme[expr] is a @subsection[#:tag "provide-syntax"]{@scheme[provide] Macros} -@note-lib-only[scheme/provide-syntax] +@note-lib-only[racket/provide-syntax] @defform*[[(define-provide-syntax id expr) (define-provide-syntax (id args ...) body ...+)]]{ @@ -2420,7 +2420,7 @@ provides a hook to control interactive evaluation through @;------------------------------------------------------------------------ @section[#:tag "nest"]{Flattening Syntactic Sequences: @scheme[nest]} -@note-lib[scheme/nest] +@note-lib[racket/nest] @defform[(nest ([datum ...+] ...) body ...+)]{ diff --git a/collects/scribblings/reference/time.scrbl b/collects/scribblings/reference/time.scrbl index 9e7694df2b..83434579e5 100644 --- a/collects/scribblings/reference/time.scrbl +++ b/collects/scribblings/reference/time.scrbl @@ -1,6 +1,6 @@ #lang scribble/doc @(require "mz.ss" - (for-label scheme/date)) + (for-label racket/date)) @title[#:tag "time"]{Time} @@ -54,7 +54,7 @@ sensitive to the value of the @envvar{TZ} environment variable, especially on Unix platforms; consult the system documentation (usually under @tt{tzset}) for details. -See also the @schememodname[scheme/date] library.} +See also the @schememodname[racket/date] library.} @defproc[(current-milliseconds) exact-integer?]{ @@ -123,7 +123,7 @@ result is the result of @scheme[expr].} @section[#:tag "date-string"]{Date Utilities} -@note-lib-only[scheme/date] +@note-lib-only[racket/date] @defproc[(date->string [date date?][time? any/c #f]) string?]{ diff --git a/collects/scribblings/reference/units.scrbl b/collects/scribblings/reference/units.scrbl index 0a893ac303..c20c0ac3c9 100644 --- a/collects/scribblings/reference/units.scrbl +++ b/collects/scribblings/reference/units.scrbl @@ -1,6 +1,6 @@ #lang scribble/doc -@(require (except-in "mz.ss" link) - (for-label scheme/unit-exptime)) +@(require "mz.ss" + (for-label racket/unit-exptime)) @(define-syntax defkeywords (syntax-rules (*) @@ -29,8 +29,8 @@ Units with suitably matching signatures can be @deftech{linked} together to form a larger unit, and a unit with no imports can be @deftech{invoked} to execute its body. -@note-lib[scheme/unit #:use-sources (mzlib/unit)]{ The -@schememodname[scheme/unit] module name can be used as a language name +@note-lib[racket/unit #:use-sources (mzlib/unit)]{ The +@schememodname[racket/unit] module name can be used as a language name with @schemefont{#lang}; see @secref["single-unit"].} @local-table-of-contents[] @@ -167,7 +167,15 @@ the corresponding import. Each @scheme[tagged-sig-id] in an (define-values-for-export (id ...) expr) (contracted [id contract] ...) (open sig-spec) - (sig-form-id . datum)])]{ + (struct id (field ...) struct-option ...) + (sig-form-id . datum)] + + [field id + [id #:mutable]] + [srtuct-option #:mutable + #:omit-constructor + #:omit-define-syntaxes + #:omit-define-values])]{ Binds an identifier to a signature that specifies a group of bindings for import or export: @@ -211,10 +219,15 @@ of bindings for import or export: @item{Each @scheme[(open sig-spec)] adds to the signature everything specified by @scheme[sig-spec].} + @item{Each @scheme[(struct id (field ...) struct-option ...)] adds + all of the identifiers that would be bound by @scheme[(struct id + (field ...) field-option ...)], where the extra option + @scheme[#:omit-constructor] omits the @scheme[id] identifier.} + @item{Each @scheme[(sig-form-id . datum)] extends the signature in a way that is defined by @scheme[sig-form-id], which must be bound by @scheme[define-signature-form]. One such binding is for - @scheme[struct].} + @scheme[struct/ctc].} ] @@ -641,30 +654,14 @@ declarations; @scheme[define-signature] has no splicing @scheme[begin] form.)} @defform/subs[ -(struct id (field ...) option ...) +(struct/ctc id ([field contract-expr] ...) struct-option ...) ([field id [id #:mutable]] - [option #:mutable - #:omit-constructor - #:omit-define-syntaxes - #:omit-define-values])]{ - -For use with @scheme[define-signature]. The expansion of a -@scheme[struct] signature form includes all of the identifiers that -would be bound by @scheme[(define-struct id (field ...) option ...)], -where the extra option @scheme[#:omit-constructor] omits the -@schemeidfont{make-}@scheme[id] identifier.} - -@defform/subs[ -(struct/ctc id ([field contract-expr] ...) option ...) - -([field id - [id #:mutable]] - [option #:mutable - #:omit-constructor - #:omit-define-syntaxes - #:omit-define-values])]{ + [struct-option #:mutable + #:omit-constructor + #:omit-define-syntaxes + #:omit-define-values])]{ For use with @scheme[define-signature]. The @scheme[struct/ctc] form works similarly to @scheme[struct], but the constructor, predicate, field @@ -724,7 +721,7 @@ contract. The unit name is used for the positive blame of the contract.} @section[#:tag "single-unit"]{Single-Unit Modules} -When @schememodname[scheme/unit] is used as a language name with +When @schememodname[racket/unit] is used as a language name with @schemefont{#lang}, the module body is treated as a unit body. The body must match the following @scheme[_module-body] grammar: @@ -756,7 +753,7 @@ suffix). If the module name ends in @schemeidfont{-unit}, then @section{Single-Signature Modules} -@defmodulelang[scheme/signature]{The @schememodname[scheme/signature] +@defmodulelang[racket/signature]{The @schememodname[racket/signature] language treats a module body as a unit signature.} The body must match the following @scheme[_module-body] grammar: @@ -767,8 +764,8 @@ The body must match the following @scheme[_module-body] grammar: ] See @secref["creatingunits"] for the grammar of @scheme[_sig-spec]. -Unlike the body of a @schememodname[scheme/unit] module, a -@scheme[require] in a @schememodname[scheme/signature] module must be +Unlike the body of a @schememodname[racket/unit] module, a +@scheme[require] in a @schememodname[racket/signature] module must be a literal use of @scheme[require]. @@ -784,9 +781,9 @@ name before @schemeidfont{-sig}. Otherwise, the module name serves as @section{Transformer Helpers} -@defmodule[scheme/unit-exptime #:use-sources (mzlib/unit-exptime)] +@defmodule[racket/unit-exptime #:use-sources (mzlib/unit-exptime)] -The @schememodname[scheme/unit-exptime] library provides procedures +The @schememodname[racket/unit-exptime] library provides procedures that are intended for use by macro transformers. In particular, the library is typically imported using @scheme[for-syntax] into a module that defines macro with @scheme[define-syntax]. diff --git a/collects/scribblings/reference/unsafe.scrbl b/collects/scribblings/reference/unsafe.scrbl index a9587c8cdc..564a6d788d 100644 --- a/collects/scribblings/reference/unsafe.scrbl +++ b/collects/scribblings/reference/unsafe.scrbl @@ -1,17 +1,17 @@ #lang scribble/doc @(require "mz.ss" - (for-label scheme/unsafe/ops - scheme/flonum - (only-in scheme/foreign + (for-label racket/unsafe/ops + racket/flonum + (only-in racket/unsafe/ffi f64vector? f64vector-ref f64vector-set!))) @title[#:tag "unsafe"]{Unsafe Operations} -@defmodule[scheme/unsafe/ops] +@defmodule[racket/unsafe/ops] -All fuctions and forms provided by @schememodname[scheme/base] and +All fuctions and forms provided by @schememodname[racket/base] and @schememodname[scheme] check their arguments to ensure that the arguments conform to contracts and other constraints. For example, @scheme[vector-ref] checks its arguments to ensure that the first @@ -19,7 +19,7 @@ argument is a vector, that the second argument is an exact integer, and that the second argument is between @scheme[0] and one less than the vector's length, inclusive. -Functions provided by @schememodname[scheme/unsafe/ops] are +Functions provided by @schememodname[racket/unsafe/ops] are @deftech{unsafe}. They have certain constraints, but the constraints are not checked, which allows the system to generate and execute faster code. If arguments violate an unsafe function's constraints, diff --git a/collects/scribblings/reference/vectors.scrbl b/collects/scribblings/reference/vectors.scrbl index 89ed54b763..b39b281d93 100644 --- a/collects/scribblings/reference/vectors.scrbl +++ b/collects/scribblings/reference/vectors.scrbl @@ -148,10 +148,10 @@ _i)] is the value produced by @scheme[(proc _i)]. @; ---------------------------------------- @section{Additional Vector Functions} -@note-lib[scheme/vector] +@note-lib[racket/vector] @(define vec-eval (make-base-eval)) @(interaction-eval #:eval vec-eval - (require scheme/vector)) + (require racket/vector)) @defproc[(vector-map [proc procedure?] [vec vector?] ...+) vector?]{ diff --git a/collects/scribblings/scheme/info.ss b/collects/scribblings/scheme/info.ss new file mode 100644 index 0000000000..863e92cc67 --- /dev/null +++ b/collects/scribblings/scheme/info.ss @@ -0,0 +1,3 @@ +#lang setup/infotab + +(define scribblings '(("scheme.scrbl" (multi-page) (legacy 60)))) diff --git a/collects/scribblings/scheme/scheme.scrbl b/collects/scribblings/scheme/scheme.scrbl new file mode 100644 index 0000000000..55ddc949b2 --- /dev/null +++ b/collects/scribblings/scheme/scheme.scrbl @@ -0,0 +1,124 @@ +#lang scribble/manual +@(require (for-syntax racket) + (for-label (only-in scheme/foreign unsafe! provide* define-unsafer))) + +@(define-syntax-rule (def-extras unit-struct) + (begin + (require (for-label scheme)) + (define unit-struct (racket struct)))) +@(def-extras unit-struct) + +@(define-syntax-rule (compat-except sid rid . rest) + (begin + @section[@schememodname[sid]] + @defmodule[sid] + "The " @schememodname[sid] " library re-exports " @racketmodname[rid] (begin . rest) ".")) +@(define-syntax-rule (compat sid rid) + (compat-except sid rid)) + +@title{@bold{Scheme}: Compatibility Libraries} + +Racket was once called ``PLT Scheme,'' and a number of libraries with +names starting @schemeidfont{scheme} provide compatibility with the +old name. + +@table-of-contents[] + +@compat-except[scheme racket]{, except that @schememodname[racket]'s +@scheme[struct] is not exported, and a @|unit-struct| from +@schememodname[scheme/unit] is exported, instead} + +@compat-except[scheme/base racket/base]{, except that +@schememodname[racket]'s @scheme[struct] is not exported} + +@compat[scheme/async-channel racket/async-channel] +@compat[scheme/bool racket/bool] +@compat[scheme/class racket/class] +@compat[scheme/cmdline racket/cmdline] +@compat[scheme/contract racket/contract] +@compat[scheme/control racket/control] +@compat[scheme/date racket/date] +@compat[scheme/dict racket/dict] +@; @compat[scheme/fasl racket/fasl] +@compat[scheme/file racket/file] +@compat[scheme/fixnum racket/fixnum] +@compat[scheme/flonum racket/flonum] + +@; ---------------------------------------------------------------------- + +@compat-except[scheme/foreign racket/unsafe/ffi]{, except that @scheme[unsafe!] +must be used to import the unsafe bindings of @scheme[racket/unsafe/ffi]} + +@defform[(unsafe!)]{ + +Makes unsafe bindings available.} + + +@defform/subs[#:literals (unsafe rename-out) + (provide* provide-star-spec ...) + ([provide-star-spec (unsafe id) + (unsafe (rename-out [id external-id])) + provide-spec])]{ + +Like @scheme[provide], but @scheme[id]s under @scheme[unsafe] are not +actually provided. Instead, they are collected for introduction into +an importing module via a macro created by @scheme[define-unsafer].} + +@defform[(define-unsafer id)]{ + +Cooperates with @scheme[provide*] to define @scheme[id] as a +@scheme[unsafe!]-like form that introduces definitions for each +binding provided as @scheme[unsafe]. The @scheme[define-unsafer] form +must occur after all the @scheme[provide*] forms to which it refers.} + +@; ---------------------------------------------------------------------- + +@compat[scheme/function racket/function] +@compat[scheme/future racket/future] +@compat[scheme/generator racket/generator] +@compat-except[scheme/gui racket/gui]{, except that it builds on +@schememodname[scheme] instead of @schememodname[racket]} +@compat[scheme/gui/base racket/gui/base] +@compat[scheme/gui/dynamic racket/gui/dynamic] +@compat[scheme/help racket/help] +@compat[scheme/include racket/include] +@compat[scheme/init racket/init] +@compat[scheme/list racket/list] +@compat[scheme/load racket/load] +@compat[scheme/local racket/local] +@compat[scheme/match racket/match] +@compat[scheme/math racket/math] +@compat[scheme/mpair racket/mpair] +@compat[scheme/nest racket/nest] +@compat[scheme/package racket/package] +@compat[scheme/path racket/path] +@compat[scheme/port racket/port] +@compat[scheme/pretty racket/pretty] +@compat[scheme/promise racket/promise] +@compat[scheme/provide racket/provide] +@compat[scheme/provide-syntax racket/provide-syntax] +@compat[scheme/provide-transform racket/provide-transform] +@compat[scheme/require racket/require] +@compat[scheme/require-syntax racket/require-syntax] +@compat[scheme/require-transform racket/require-transform] +@compat[scheme/runtime-path racket/runtime-path] +@compat[scheme/serialize racket/serialize] +@compat[scheme/set racket/set] +@compat[scheme/signature racket/signature] +@compat[scheme/shared racket/shared] +@compat[scheme/splicing racket/splicing] +@compat[scheme/string racket/string] +@compat[scheme/struct-info racket/struct-info] +@compat[scheme/stxparam racket/stxparam] +@compat[scheme/stxparam-exptime racket/stxparam-exptime] +@compat[scheme/surrogate racket/surrogate] +@compat[scheme/system racket/system] +@compat[scheme/tcp racket/tcp] +@; @compat[scheme/trace racket/trace] +@compat[scheme/trait racket/trait] +@compat[scheme/udp racket/udp] +@compat[scheme/unit racket/unit] +@compat[scheme/unit-exptime racket/unit-exptime] +@compat[scheme/unsafe/ops racket/unsafe/ops] +@compat[scheme/vector racket/vector] + diff --git a/collects/scriblib/gui-eval.ss b/collects/scriblib/gui-eval.ss index a18629f73e..49d988c4b3 100644 --- a/collects/scriblib/gui-eval.ss +++ b/collects/scriblib/gui-eval.ss @@ -1,14 +1,14 @@ -#lang scheme/base +#lang racket/base (require scribble/eval scribble/core scribble/scheme - scheme/class - scheme/file - scheme/runtime-path - scheme/serialize + racket/class + racket/file + racket/runtime-path + racket/serialize "private/gui-eval-exn.ss" - scheme/system) + racket/system) (define-syntax define-mr (syntax-rules () @@ -28,13 +28,16 @@ (define-mr gui-interaction-eval-show interaction-eval-show) (define-mr gui-def+int def+int) (define-mr gui-defs+int defs+int) -(define-mr gui-schememod+eval schememod+eval) -(define-mr gui-schemeblock+eval schemeblock+eval) +(define-mr gui-racketmod+eval racketmod+eval) +(define-mr gui-racketblock+eval racketblock+eval) + +(provide (rename-out [gui-racketmod+eval gui-schememod+eval] + [gui-racketblock+eval gui-schemeblock+eval])) (define mred? (getenv "MREVAL")) (when mred? - (gui-eval '(require scheme/gui/base)) + (gui-eval '(require racket/gui/base)) (gui-eval '(require slideshow))) ;; This one needs to be relative, because it ends up in the diff --git a/collects/slideshow/main.ss b/collects/slideshow/main.ss index 61f2e845ce..923b1368f7 100644 --- a/collects/slideshow/main.ss +++ b/collects/slideshow/main.ss @@ -1,8 +1,8 @@ -(module main scheme +(module main racket (require "base.ss" "pict.ss") - (provide (all-from-out scheme + (provide (all-from-out racket "base.ss" "pict.ss"))) From 909f43f9a23d2d51296ef52635beae7e36f43210 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 22 Apr 2010 20:18:53 -0600 Subject: [PATCH 05/43] work on racketing reference --- collects/scribble/racket.ss | 985 +++++++++++ collects/scribble/scheme.ss | 988 +---------- .../scribblings/main/getting-started.scrbl | 7 +- .../scribblings/reference/eval-model.scrbl | 286 ++-- collects/scribblings/reference/prog-steps.ss | 2 +- .../scribblings/reference/syntax-model.scrbl | 422 ++--- collects/scribblings/reference/syntax.scrbl | 1517 ++++++++--------- 7 files changed, 2103 insertions(+), 2104 deletions(-) create mode 100644 collects/scribble/racket.ss diff --git a/collects/scribble/racket.ss b/collects/scribble/racket.ss new file mode 100644 index 0000000000..977a38e7cd --- /dev/null +++ b/collects/scribble/racket.ss @@ -0,0 +1,985 @@ +(module racket racket/base + (require "core.ss" + "basic.ss" + "search.ss" + "private/manual-sprop.ss" + "private/on-demand.ss" + mzlib/class + mzlib/for + syntax/modresolve + syntax/modcode + (for-syntax racket/base)) + + (provide define-code + to-element + to-element/no-color + to-paragraph + to-paragraph/prefix + syntax-ize + syntax-ize-hook + current-keyword-list + current-variable-list + current-meta-list + + input-color + output-color + input-background-color + no-color + reader-color + result-color + keyword-color + comment-color + paren-color + meta-color + value-color + symbol-color + variable-color + opt-color + error-color + syntax-link-color + value-link-color + module-color + module-link-color + block-color + highlighted-color + + (struct-out var-id) + (struct-out shaped-parens) + (struct-out just-context) + (struct-out alternate-display) + (struct-out literal-syntax) + (for-syntax make-variable-id + variable-id? + make-element-id-transformer + element-id-transformer?)) + + (define (make-racket-style s #:tt? [tt? #t]) + (make-style s (if tt? + (cons 'tt-chars scheme-properties) + scheme-properties))) + + (define-on-demand output-color (make-racket-style "ScmOut")) + (define-on-demand input-color (make-racket-style "ScmIn")) + (define-on-demand input-background-color (make-racket-style "ScmInBG")) + (define-on-demand no-color (make-racket-style "ScmPlain")) + (define-on-demand reader-color (make-racket-style "ScmRdr")) + (define-on-demand result-color (make-racket-style "ScmRes")) + (define-on-demand keyword-color (make-racket-style "ScmKw")) + (define-on-demand comment-color (make-racket-style "ScmCmt")) + (define-on-demand paren-color (make-racket-style "ScmPn")) + (define-on-demand meta-color (make-racket-style "ScmMeta")) + (define-on-demand value-color (make-racket-style "ScmVal")) + (define-on-demand symbol-color (make-racket-style "ScmSym")) + (define-on-demand variable-color (make-racket-style "ScmVar")) + (define-on-demand opt-color (make-racket-style "ScmOpt")) + (define-on-demand error-color (make-racket-style "ScmErr" #:tt? #f)) + (define-on-demand syntax-link-color (make-racket-style "ScmStxLink")) + (define-on-demand value-link-color (make-racket-style "ScmValLink")) + (define-on-demand module-color (make-racket-style "ScmMod")) + (define-on-demand module-link-color (make-racket-style "ScmModLink")) + (define-on-demand block-color (make-racket-style "ScmBlk")) + (define-on-demand highlighted-color (make-racket-style "highlighted" #:tt? #f)) + + (define current-keyword-list + (make-parameter null)) + (define current-variable-list + (make-parameter null)) + (define current-meta-list + (make-parameter null)) + + (define defined-names (make-hasheq)) + + (define-struct (sized-element element) (length)) + + (define-struct (spaces element) (cnt)) + + (define (literalize-spaces i) + (let ([m (regexp-match-positions #rx" +" i)]) + (if m + (let ([cnt (- (cdar m) (caar m))]) + (make-spaces #f + (list + (literalize-spaces (substring i 0 (caar m))) + (hspace cnt) + (literalize-spaces (substring i (cdar m)))) + cnt)) + i))) + + + (define line-breakable-space (make-element 'tt " ")) + + ;; These caches intentionally record a key with the value. + ;; That way, when the value is no longer used, the key + ;; goes away, and the entry is gone. + + (define id-element-cache (make-weak-hash)) + (define element-cache (make-weak-hash)) + + (define-struct (cached-delayed-element delayed-element) (cache-key)) + (define-struct (cached-element element) (cache-key)) + + (define (make-id-element c s) + (let* ([key (and id-element-cache + (let ([b (identifier-label-binding c)]) + (vector (syntax-e c) + (module-path-index->taglet (caddr b)) + (cadddr b) + (list-ref b 5))))]) + (or (and key + (let ([b (hash-ref id-element-cache key #f)]) + (and b + (weak-box-value b)))) + (let ([e (make-cached-delayed-element + (lambda (renderer sec ri) + (let* ([tag (find-racket-tag sec ri c #f)]) + (if tag + (list + (case (car tag) + [(form) + (make-link-element syntax-link-color (list s) tag)] + [else + (make-link-element value-link-color (list s) tag)])) + (list + (make-element "badlink" + (make-element value-link-color s)))))) + (lambda () s) + (lambda () s) + key)]) + (when key + (hash-set! id-element-cache key (make-weak-box e))) + e)))) + + (define (make-element/cache style content) + (if (and element-cache + (string? content)) + (let ([key (vector style content)]) + (let ([b (hash-ref element-cache key #f)]) + (or (and b (weak-box-value b)) + (let ([e (make-cached-element style content key)]) + (hash-set! element-cache key (make-weak-box e)) + e)))) + (make-element style content))) + + (define (to-quoted qs qq? quote-depth out color? inc!) + (if (and qq? (zero? quote-depth)) + (begin + (out qs (and color? value-color)) + (inc!) + (add1 quote-depth)) + quote-depth)) + + (define (to-unquoted qq? quote-depth out color? inc!) + (if (or (not qq?) (zero? quote-depth)) + quote-depth + (begin + (out "," (and color? meta-color)) + (inc!) + (to-unquoted qq? (sub1 quote-depth) out color? inc!)))) + + (define (typeset-atom c out color? quote-depth qq?) + (if (and (var-id? (syntax-e c)) + (zero? quote-depth)) + (out (format "~s" (let ([v (var-id-sym (syntax-e c))]) + (if (syntax? v) + (syntax-e v) + v))) + variable-color) + (let*-values ([(is-var?) (and (identifier? c) + (memq (syntax-e c) (current-variable-list)))] + [(s it? sub?) + (let ([sc (syntax-e c)]) + (let ([s (or (syntax-property c 'display-string) + (format "~s" (if (literal-syntax? sc) + (literal-syntax-stx sc) + (if (var-id? sc) + (var-id-sym sc) + sc))))]) + (if (and (symbol? sc) + ((string-length s) . > . 1) + (char=? (string-ref s 0) #\_) + (not (or (identifier-label-binding c) + is-var?))) + (values (substring s 1) #t #f) + (values s #f #f))))]) + (let ([quote-depth (if (and qq? (identifier? c)) + (let ([quote-depth + (if (and (quote-depth . < . 2) + (memq (syntax-e c) '(unquote unquote-splicing))) + (to-unquoted qq? quote-depth out color? void) + quote-depth)]) + (to-quoted "'" qq? quote-depth out color? void)) + quote-depth)]) + (if (or (element? (syntax-e c)) + (delayed-element? (syntax-e c)) + (part-relative-element? (syntax-e c))) + (out (syntax-e c) #f) + (out (if (and (identifier? c) + color? + (quote-depth . <= . 0) + (not (or it? is-var?))) + (if (pair? (identifier-label-binding c)) + (make-id-element c s) + s) + (literalize-spaces s)) + (cond + [(positive? quote-depth) value-color] + [(let ([v (syntax-e c)]) + (or (number? v) + (string? v) + (bytes? v) + (char? v) + (regexp? v) + (byte-regexp? v) + (boolean? v))) + value-color] + [(identifier? c) + (cond + [is-var? + variable-color] + [(and (identifier? c) + (memq (syntax-e c) (current-keyword-list))) + keyword-color] + [(and (identifier? c) + (memq (syntax-e c) (current-meta-list))) + meta-color] + [it? variable-color] + [else symbol-color])] + [else paren-color]) + (string-length s))))))) + + (define omitable (make-style #f '(omitable))) + + (define (gen-typeset c multi-line? prefix1 prefix suffix color? qq?) + (let* ([c (syntax-ize c 0 #:qq? qq?)] + [content null] + [docs null] + [first (syntax-case c (code:line) + [(code:line e . rest) #'e] + [else c])] + [init-col (or (syntax-column first) 0)] + [src-col init-col] + [inc-src-col (lambda () (set! src-col (add1 src-col)))] + [dest-col 0] + [highlight? #f] + [col-map (make-hash)] + [next-col-map (make-hash)] + [line (or (syntax-line first) 0)]) + (define (finish-line!) + (when multi-line? + (set! docs (cons (make-paragraph omitable (reverse content)) + docs)) + (set! content null))) + (define out + (case-lambda + [(v cls) + (out v cls (let sz-loop ([v v]) + (cond + [(string? v) (string-length v)] + [(list? v) (for/fold ([s 0]) ([v (in-list v)]) (+ s (sz-loop v)))] + [(sized-element? v) (sized-element-length v)] + [(element? v) + (sz-loop (element-content v))] + [(delayed-element? v) + (content-width v)] + [(part-relative-element? v) + (content-width v)] + [(spaces? v) + (+ (sz-loop (car (element-content v))) + (spaces-cnt v) + (sz-loop (caddr (element-content v))))] + [else 1])))] + [(v cls len) + (unless (equal? v "") + (cond + [(spaces? v) + (out (car (element-content v)) cls 0) + (out (cadr (element-content v)) #f 0) + (out (caddr (element-content v)) cls len)] + [(equal? v "\n") + (if multi-line? + (begin + (finish-line!) + (out prefix cls)) + (out " " cls))] + [else + (set! content (cons ((if highlight? + (lambda (c) + (make-element highlighted-color c)) + values) + (if (and color? cls) + (make-element/cache cls v) + v)) + content)) + (set! dest-col (+ dest-col len))]))])) + (define advance + (case-lambda + [(c init-line! delta) + (let ([c (+ delta (or (syntax-column c) 0))] + [l (syntax-line c)]) + (let ([new-line? (and l (l . > . line))]) + (when new-line? + (for ([i (in-range (- l line))]) + (out "\n" no-color)) + (set! line l) + (set! col-map next-col-map) + (set! next-col-map (make-hash)) + (init-line!)) + (let ([d-col (let ([def-val (+ dest-col (- c src-col))]) + (if new-line? + (hash-ref col-map c def-val) + def-val))]) + (let ([amt (- d-col dest-col)]) + (when (positive? amt) + (let ([old-dest-col dest-col]) + (out (if (and (= 1 amt) (not multi-line?)) + line-breakable-space ; allows a line break to replace the space + (hspace amt)) + #f) + (set! dest-col (+ old-dest-col amt)))))) + (set! src-col c) + (hash-set! next-col-map src-col dest-col)))] + [(c init-line!) (advance c init-line! 0)])) + (define (convert-infix c quote-depth qq?) + (let ([l (syntax->list c)]) + (and l + ((length l) . >= . 3) + ((or (syntax-position (car l)) -inf.0) + . > . + (or (syntax-position (cadr l)) +inf.0)) + (let ([a (car l)]) + (let loop ([l (cdr l)] + [prev null]) + (cond + [(null? l) #f] ; couldn't unwind + [else (let ([p2 (syntax-position (car l))]) + (if (and p2 + (p2 . > . (syntax-position a))) + (datum->syntax c + (append + (reverse prev) + (list + (datum->syntax + a + (let ([val? (positive? quote-depth)]) + (make-sized-element + (if val? value-color #f) + (list + (make-element/cache (if val? value-color paren-color) '". ") + (typeset a #f "" "" "" (not val?) qq?) + (make-element/cache (if val? value-color paren-color) '" .")) + (+ (syntax-span a) 4))) + (list (syntax-source a) + (syntax-line a) + (- (syntax-column a) 2) + (- (syntax-position a) 2) + (+ (syntax-span a) 4)) + a)) + l) + c + c) + (loop (cdr l) + (cons (car l) prev))))])))))) + (define (no-fancy-chars s) + (cond + [(eq? s 'rsquo) "'"] + [else s])) + (define (loop init-line! quote-depth qq?) + (lambda (c) + (cond + [(eq? 'code:blank (syntax-e c)) + (advance c init-line!)] + [(and (pair? (syntax-e c)) + (eq? (syntax-e (car (syntax-e c))) 'code:comment)) + (let ([l (syntax->list c)]) + (unless (and l (= 2 (length l))) + (raise-syntax-error + #f + "does not have a single sub-form" + c))) + (advance c init-line!) + (out ";" comment-color) + (out 'nbsp comment-color) + (let ([v (syntax->datum (cadr (syntax->list c)))]) + (if (paragraph? v) + (map (lambda (v) + (let ([v (no-fancy-chars v)]) + (if (or (string? v) (symbol? v)) + (out v comment-color) + (out v #f)))) + (paragraph-content v)) + (out (no-fancy-chars v) comment-color)))] + [(and (pair? (syntax-e c)) + (eq? (syntax-e (car (syntax-e c))) 'code:contract)) + (advance c init-line!) + (out "; " comment-color) + (let* ([l (cdr (syntax->list c))] + [s-col (or (syntax-column (car l)) src-col)]) + (set! src-col s-col) + (for-each (loop (lambda () + (set! src-col s-col) + (set! dest-col 0) + (out "; " comment-color)) + 0 + qq?) + l))] + [(and (pair? (syntax-e c)) + (eq? (syntax-e (car (syntax-e c))) 'code:line)) + (let ([l (cdr (syntax->list c))]) + (for-each (loop init-line! quote-depth qq?) + l))] + [(and (pair? (syntax-e c)) + (eq? (syntax-e (car (syntax-e c))) 'code:hilite)) + (let ([l (syntax->list c)] + [h? highlight?]) + (unless (and l (= 2 (length l))) + (error "bad code:redex: ~e" (syntax->datum c))) + (advance c init-line!) + (set! src-col (syntax-column (cadr l))) + (hash-set! next-col-map src-col dest-col) + (set! highlight? #t) + ((loop init-line! quote-depth qq?) (cadr l)) + (set! highlight? h?) + (set! src-col (add1 src-col)))] + [(and (pair? (syntax-e c)) + (eq? (syntax-e (car (syntax-e c))) 'code:quote)) + (advance c init-line!) + (let ([quote-depth (to-quoted "`" qq? quote-depth out color? inc-src-col)]) + (out "(" (if (positive? quote-depth) value-color paren-color)) + (set! src-col (+ src-col 1)) + (hash-set! next-col-map src-col dest-col) + ((loop init-line! quote-depth qq?) + (datum->syntax #'here 'quote (car (syntax-e c)))) + (for-each (loop init-line! (add1 quote-depth) qq?) + (cdr (syntax->list c))) + (out ")" (if (positive? quote-depth) value-color paren-color)) + (set! src-col (+ src-col 1)) + #; + (hash-set! next-col-map src-col dest-col))] + [(and (pair? (syntax-e c)) + (memq (syntax-e (car (syntax-e c))) + '(quote quasiquote unquote unquote-splicing + quasisyntax syntax unsyntax unsyntax-splicing)) + (let ([v (syntax->list c)]) + (and v (= 2 (length v)))) + (or (not qq?) + (quote-depth . > . 1) + (not (memq (syntax-e (car (syntax-e c))) + '(unquote unquote-splicing))))) + (advance c init-line!) + (let ([quote-depth (to-quoted "`" qq? quote-depth out color? inc-src-col)]) + (let-values ([(str quote-delta) + (case (syntax-e (car (syntax-e c))) + [(quote) (values "'" +inf.0)] + [(unquote) (values "," -1)] + [(unquote-splicing) (values ",@" -1)] + [(quasiquote) (values "`" +1)] + [(syntax) (values "#'" 0)] + [(quasisyntax) (values "#`" 0)] + [(unsyntax) (values "#," 0)] + [(unsyntax-splicing) (values "#,@" 0)])]) + (out str (if (positive? (+ quote-depth quote-delta)) + value-color + reader-color)) + (let ([i (cadr (syntax->list c))]) + (set! src-col (or (syntax-column i) src-col)) + (hash-set! next-col-map src-col dest-col) + ((loop init-line! (+ quote-depth quote-delta) qq?) i))))] + [(and (pair? (syntax-e c)) + (convert-infix c quote-depth qq?)) + => (lambda (converted) + ((loop init-line! quote-depth qq?) converted))] + [(or (pair? (syntax-e c)) + (null? (syntax-e c)) + (vector? (syntax-e c)) + (and (struct? (syntax-e c)) + (prefab-struct-key (syntax-e c))) + (struct-proxy? (syntax-e c))) + (let* ([sh (or (syntax-property c 'paren-shape) + #\()] + [quote-depth (if (and (not qq?) + (zero? quote-depth) + (or (vector? (syntax-e c)) + (struct? (syntax-e c)))) + +inf.0 + quote-depth)] + [p-color (if (positive? quote-depth) + value-color + (if (eq? sh #\?) + opt-color + paren-color))]) + (advance c init-line!) + (let ([quote-depth (if (struct-proxy? (syntax-e c)) + (to-unquoted qq? quote-depth out color? inc-src-col) + (to-quoted "`" qq? quote-depth out color? inc-src-col))]) + (when (vector? (syntax-e c)) + (let ([vec (syntax-e c)]) + (out "#" #;(format "#~a" (vector-length vec)) p-color) + (if (zero? (vector-length vec)) + (set! src-col (+ src-col (- (syntax-span c) 2))) + (set! src-col (+ src-col (- (syntax-column (vector-ref vec 0)) + (syntax-column c) + 1)))))) + (when (struct? (syntax-e c)) + (out "#s" p-color) + (set! src-col (+ src-col 2))) + (out (case sh + [(#\[ #\?) "["] + [(#\{) "{"] + [else "("]) + p-color) + (set! src-col (+ src-col 1)) + (hash-set! next-col-map src-col dest-col) + (let lloop ([l (cond + [(vector? (syntax-e c)) + (vector->short-list (syntax-e c) syntax-e)] + [(struct? (syntax-e c)) + (let ([l (vector->list (struct->vector (syntax-e c)))]) + ;; Need to build key datum, syntax-ize it internally, and + ;; set the overall width to fit right: + (cons (let ([key (syntax-ize (prefab-struct-key (syntax-e c)) + (+ 3 (or (syntax-column c) 0)) + (or (syntax-line c) 1))] + [end (if (pair? (cdr l)) + (and (equal? (syntax-line c) (syntax-line (cadr l))) + (syntax-column (cadr l))) + (and (syntax-column c) + (+ (syntax-column c) (syntax-span c))))]) + (if end + (datum->syntax #f + (syntax-e key) + (vector #f (syntax-line key) + (syntax-column key) + (syntax-position key) + (- end 1 (syntax-column key)))) + end)) + (cdr l)))] + [(struct-proxy? (syntax-e c)) + (cons + (struct-proxy-name (syntax-e c)) + (struct-proxy-content (syntax-e c)))] + [else c])] + [first-qq? (and qq? (not (struct-proxy? (syntax-e c))))]) + (cond + [(and (syntax? l) + (pair? (syntax-e l)) + (not (and (memq (syntax-e (car (syntax-e l))) + '(quote unquote syntax unsyntax quasiquote quasiunsyntax)) + (let ([v (syntax->list l)]) + (and v (= 2 (length v)))) + (or (not qq?) + (quote-depth . > . 1) + (not (memq (syntax-e (car (syntax-e l))) + '(unquote unquote-splicing))))))) + (lloop (syntax-e l) first-qq?)] + [(or (null? l) + (and (syntax? l) + (null? (syntax-e l)))) + (void)] + [(pair? l) + ((loop init-line! quote-depth first-qq?) (car l)) + (lloop (cdr l) qq?)] + [else + (advance l init-line! -2) + (out ". " (if (positive? quote-depth) value-color paren-color)) + (set! src-col (+ src-col 3)) + (hash-set! next-col-map src-col dest-col) + ((loop init-line! quote-depth first-qq?) l)])) + (out (case sh + [(#\[ #\?) "]"] + [(#\{) "}"] + [else ")"]) + p-color) + (set! src-col (+ src-col 1)) + #; + (hash-set! next-col-map src-col dest-col)))] + [(box? (syntax-e c)) + (advance c init-line!) + (let ([quote-depth (to-quoted "`" qq? quote-depth out color? inc-src-col)]) + (out "#&" value-color) + (set! src-col (+ src-col 2)) + (hash-set! next-col-map src-col dest-col) + ((loop init-line! (if qq? quote-depth +inf.0) qq?) (unbox (syntax-e c))))] + [(hash? (syntax-e c)) + (advance c init-line!) + (let ([equal-table? (not (hash-eq? (syntax-e c)))] + [quote-depth (to-quoted "`" qq? quote-depth out color? inc-src-col)]) + (out (if equal-table? + "#hash" + "#hasheq") + value-color) + (let ([delta (+ 5 (if equal-table? 2 0))] + [orig-col src-col]) + (set! src-col (+ src-col delta)) + (hash-set! next-col-map src-col dest-col) + ((loop init-line! (if qq? quote-depth +inf.0) qq?) + (syntax-ize (hash-map (syntax-e c) cons) + (+ (syntax-column c) delta))) + (set! src-col (+ orig-col (syntax-span c)))))] + [(graph-reference? (syntax-e c)) + (advance c init-line!) + (out (format "#~a#" (unbox (graph-reference-bx (syntax-e c)))) + (if (positive? quote-depth) + value-color + paren-color)) + (set! src-col (+ src-col (syntax-span c)))] + [(graph-defn? (syntax-e c)) + (advance c init-line!) + (let ([bx (graph-defn-bx (syntax-e c))]) + (out (format "#~a=" (unbox bx)) + (if (positive? quote-depth) + value-color + paren-color)) + (set! src-col (+ src-col 3)) + ((loop init-line! quote-depth qq?) (graph-defn-r (syntax-e c))))] + [else + (advance c init-line!) + (typeset-atom c out color? quote-depth qq?) + (set! src-col (+ src-col (or (syntax-span c) 1))) + #; + (hash-set! next-col-map src-col dest-col)]))) + (out prefix1 #f) + (set! dest-col 0) + (hash-set! next-col-map init-col dest-col) + ((loop (lambda () (set! src-col init-col) (set! dest-col 0)) 0 qq?) c) + (if (list? suffix) + (map (lambda (sfx) + (finish-line!) + (out sfx #f)) + suffix) + (out suffix #f)) + (unless (null? content) + (finish-line!)) + (if multi-line? + (if (= 1 (length docs)) + (car docs) + (make-table block-color (map list (reverse docs)))) + (make-sized-element #f (reverse content) dest-col)))) + + (define (typeset c multi-line? prefix1 prefix suffix color? qq?) + (let* ([c (syntax-ize c 0 #:qq? qq?)] + [s (syntax-e c)]) + (if (or multi-line? + (eq? 'code:blank s) + (pair? s) + (vector? s) + (struct? s) + (box? s) + (null? s) + (hash? s) + (graph-defn? s) + (graph-reference? s) + (struct-proxy? s)) + (gen-typeset c multi-line? prefix1 prefix suffix color? qq?) + (typeset-atom c + (letrec ([mk + (case-lambda + [(elem color) + (mk elem color (or (syntax-span c) 1))] + [(elem color len) + (if (and (string? elem) + (= len (string-length elem))) + (make-element/cache (and color? color) elem) + (make-sized-element (and color? color) elem len))])]) + mk) + color? 0 qq?)))) + + (define (to-element c #:qq? [qq? #f]) + (typeset c #f "" "" "" #t qq?)) + + (define (to-element/no-color c #:qq? [qq? #f]) + (typeset c #f "" "" "" #f qq?)) + + (define (to-paragraph c #:qq? [qq? #f]) + (typeset c #t "" "" "" #t qq?)) + + (define ((to-paragraph/prefix pfx1 pfx sfx) c #:qq? [qq? #f]) + (typeset c #t pfx1 pfx sfx #t qq?)) + + (begin-for-syntax + (define-struct variable-id (sym) + #:omit-define-syntaxes + #:property prop:procedure (lambda (self stx) + (raise-syntax-error + #f + (string-append + "misuse of an identifier (not in `racket', etc.) that is" + " bound as a code-typesetting variable") + stx))) + (define-struct element-id-transformer (proc) + #:omit-define-syntaxes + #:property prop:procedure (lambda (self stx) + (raise-syntax-error + #f + (string-append + "misuse of an identifier (not in `racket', etc.) that is" + " bound as an code-typesetting element transformer") + stx)))) + + (define-syntax (define-code stx) + (syntax-case stx () + [(_ code typeset-code uncode d->s stx-prop) + (syntax/loc stx + (define-syntax (code stx) + (define (wrap-loc v ctx e) + `(,#'d->s ,ctx + ,e + #(code + ,(syntax-line v) + ,(syntax-column v) + ,(syntax-position v) + ,(syntax-span v)))) + (define (stx->loc-s-expr v) + (let ([slv (and (identifier? v) + (syntax-local-value v (lambda () #f)))]) + (cond + [(variable-id? slv) + (wrap-loc v #f `(,#'make-var-id ',(variable-id-sym slv)))] + [(element-id-transformer? slv) + (wrap-loc v #f ((element-id-transformer-proc slv) v))] + [(syntax? v) + (let ([mk (wrap-loc + v + `(quote-syntax ,(datum->syntax v 'defcode)) + (syntax-case v (uncode) + [(uncode e) #'e] + [else (stx->loc-s-expr (syntax-e v))]))]) + (let ([prop (syntax-property v 'paren-shape)]) + (if prop + `(,#'stx-prop ,mk 'paren-shape ,prop) + mk)))] + [(null? v) 'null] + [(list? v) `(list . ,(map stx->loc-s-expr v))] + [(pair? v) `(cons ,(stx->loc-s-expr (car v)) + ,(stx->loc-s-expr (cdr v)))] + [(vector? v) `(vector ,@(map + stx->loc-s-expr + (vector->list v)))] + [(and (struct? v) (prefab-struct-key v)) + `(make-prefab-struct (quote ,(prefab-struct-key v)) + ,@(map + stx->loc-s-expr + (cdr (vector->list (struct->vector v)))))] + [(box? v) `(box ,(stx->loc-s-expr (unbox v)))] + [else `(quote ,v)]))) + (define (cvt s) + (datum->syntax #'here (stx->loc-s-expr s) #f)) + (if (eq? (syntax-local-context) 'expression) + (syntax-case stx () + [(_ expr) #`(typeset-code #,(cvt #'expr))] + [(_ expr (... ...)) + #`(typeset-code #,(cvt #'(code:line expr (... ...))))]) + (quasisyntax/loc stx + (#%expression #,stx)))))] + [(_ code typeset-code uncode d->s) + #'(define-code code typeset-code uncode d->s syntax-property)] + [(_ code typeset-code uncode) + #'(define-code code typeset-code uncode datum->syntax syntax-property)] + [(_ code typeset-code) #'(define-code code typeset-code unsyntax)])) + + + (define syntax-ize-hook (make-parameter (lambda (v col) #f))) + + (define (vector->short-list v extract) + (vector->list v) + #; + (let ([l (vector->list v)]) + (reverse (list-tail + (reverse l) + (- (vector-length v) + (let loop ([i (sub1 (vector-length v))]) + (cond + [(zero? i) 1] + [(eq? (extract (vector-ref v i)) + (extract (vector-ref v (sub1 i)))) + (loop (sub1 i))] + [else (add1 i)]))))))) + + (define (short-list->vector v l) + (list->vector + (let ([n (length l)]) + (if (n . < . (vector-length v)) + (reverse (let loop ([r (reverse l)][i (- (vector-length v) n)]) + (if (zero? i) + r + (loop (cons (car r) r) (sub1 i))))) + l)))) + + (define-struct var-id (sym)) + (define-struct shaped-parens (val shape)) + (define-struct just-context (val ctx)) + (define-struct alternate-display (id string)) + (define-struct literal-syntax (stx)) + (define-struct struct-proxy (name content)) + + (define-struct graph-reference (bx)) + (define-struct graph-defn (r bx)) + + (define (syntax-ize v col [line 1] #:qq? [qq? #f]) + (do-syntax-ize v col line (box #hasheq()) #f (and qq? 0))) + + (define (graph-count ht graph?) + (and graph? + (let ([n (hash-ref (unbox ht) '#%graph-count 0)]) + (set-box! ht (hash-set (unbox ht) '#%graph-count (add1 n))) + n))) + + (define (do-syntax-ize v col line ht graph? qq) + (cond + [((syntax-ize-hook) v col) + => (lambda (r) r)] + [(shaped-parens? v) + (syntax-property (do-syntax-ize (shaped-parens-val v) col line ht #f qq) + 'paren-shape + (shaped-parens-shape v))] + [(just-context? v) + (let ([s (do-syntax-ize (just-context-val v) col line ht #f qq)]) + (datum->syntax (just-context-ctx v) + (syntax-e s) + s + s + (just-context-ctx v)))] + [(alternate-display? v) + (let ([s (do-syntax-ize (alternate-display-id v) col line ht #f qq)]) + (syntax-property s + 'display-string + (alternate-display-string v)))] + [(hash-ref (unbox ht) v #f) + => (lambda (m) + (unless (unbox m) + (set-box! m #t)) + (datum->syntax #f + (make-graph-reference m) + (vector #f line col (+ 1 col) 1)))] + [(and (list? v) + (pair? v) + (let ([s (let ([s (car v)]) + (if (just-context? s) + (just-context-val s) + s))]) + (and + (or (memq s '(quaisquote quote)) + (and (memq s '(unquote unquote-splicing)) + (or (not qq) + (qq . > . 2)))) + s))) + => (lambda (s) + (let ([c (do-syntax-ize (cadr v) (+ col 1) line ht #f qq)]) + (datum->syntax #f + (list (do-syntax-ize (car v) col line ht #f + (and qq + (case s + [(quaisquote) (add1 qq)] + [(unquote unquote-splicing) (sub1 qq)] + [else qq]))) + c) + (vector #f line col (+ 1 col) + (+ 1 (syntax-span c))))))] + [(or (list? v) + (vector? v) + (and (struct? v) + (or (and qq + ;; Watch out for partially transparent subtypes of `element': + (not (element? v))) + (prefab-struct-key v)))) + (let ([orig-ht (unbox ht)] + [graph-box (box (graph-count ht graph?))] + [qq (and qq (max 1 qq))]) + (set-box! ht (hash-set (unbox ht) v graph-box)) + (let* ([graph-sz (if graph? + (+ 2 (string-length (format "~a" (unbox graph-box)))) + 0)] + [vec-sz (cond + [(vector? v) + (+ 1 #;(string-length (format "~a" (vector-length v))))] + [(struct? v) + (if (prefab-struct-key v) + 2 + 0)] + [else 0])] + [r (let ([l (let loop ([col (+ col 1 vec-sz graph-sz)] + [v (cond + [(vector? v) + (vector->short-list v values)] + [(struct? v) + (cons (let ([pf (prefab-struct-key v)]) + (if pf + (prefab-struct-key v) + (object-name v))) + (cdr (vector->list (struct->vector v))))] + [else v])]) + (if (null? v) + null + (let ([i (do-syntax-ize (car v) col line ht #f qq)]) + (cons i + (loop (+ col 1 (syntax-span i)) (cdr v))))))]) + (datum->syntax #f + (cond + [(vector? v) (short-list->vector v l)] + [(struct? v) + (let ([pf (prefab-struct-key v)]) + (if pf + (apply make-prefab-struct (prefab-struct-key v) (cdr l)) + (make-struct-proxy (car l) (cdr l))))] + [else l]) + (vector #f line + (+ graph-sz col) + (+ 1 graph-sz col) + (+ 2 + vec-sz + (if (zero? (length l)) + 0 + (sub1 (length l))) + (apply + (map syntax-span l))))))]) + (unless graph? + (set-box! ht (hash-set (unbox ht) v #f))) + (cond + [graph? (datum->syntax #f + (make-graph-defn r graph-box) + (vector #f (syntax-line r) + (- (syntax-column r) graph-sz) + (- (syntax-position r) graph-sz) + (+ (syntax-span r) graph-sz)))] + [(unbox graph-box) + ;; Go again, this time knowing that there will be a graph: + (set-box! ht orig-ht) + (do-syntax-ize v col line ht #t qq)] + [else r])))] + [(pair? v) + (let ([orig-ht (unbox ht)] + [graph-box (box (graph-count ht graph?))] + [qq (and qq (max 1 qq))]) + (set-box! ht (hash-set (unbox ht) v graph-box)) + (let* ([inc (if graph? + (+ 2 (string-length (format "~a" (unbox graph-box)))) + 0)] + [a (do-syntax-ize (car v) (+ col 1 inc) line ht #f qq)] + [sep (if (and (pair? (cdr v)) + ;; FIXME: what if it turns out to be a graph reference? + (not (hash-ref (unbox ht) (cdr v) #f))) + 0 + 3)] + [b (do-syntax-ize (cdr v) (+ col 1 inc (syntax-span a) sep) line ht #f qq)]) + (let ([r (datum->syntax #f + (cons a b) + (vector #f line (+ col inc) (+ 1 col inc) + (+ 2 sep (syntax-span a) (syntax-span b))))]) + (unless graph? + (set-box! ht (hash-set (unbox ht) v #f))) + (cond + [graph? (datum->syntax #f + (make-graph-defn r graph-box) + (vector #f line col (+ 1 col) + (+ inc (syntax-span r))))] + [(unbox graph-box) + ;; Go again... + (set-box! ht orig-ht) + (do-syntax-ize v col line ht #t qq)] + [else r]))))] + [(box? v) + (let ([a (do-syntax-ize (unbox v) (+ col 2) line ht #f (and qq (max 1 qq)))]) + (datum->syntax #f + (box a) + (vector #f line col (+ 1 col) + (+ 2 (syntax-span a)))))] + [else + (datum->syntax #f v (vector #f line col (+ 1 col) 1))]))) diff --git a/collects/scribble/scheme.ss b/collects/scribble/scheme.ss index 15ba5c77b7..67b1f198d6 100644 --- a/collects/scribble/scheme.ss +++ b/collects/scribble/scheme.ss @@ -1,985 +1,3 @@ -(module scheme scheme/base - (require "core.ss" - "basic.ss" - "search.ss" - "private/manual-sprop.ss" - "private/on-demand.ss" - mzlib/class - mzlib/for - syntax/modresolve - syntax/modcode - (for-syntax scheme/base)) - - (provide define-code - to-element - to-element/no-color - to-paragraph - to-paragraph/prefix - syntax-ize - syntax-ize-hook - current-keyword-list - current-variable-list - current-meta-list - - input-color - output-color - input-background-color - no-color - reader-color - result-color - keyword-color - comment-color - paren-color - meta-color - value-color - symbol-color - variable-color - opt-color - error-color - syntax-link-color - value-link-color - module-color - module-link-color - block-color - highlighted-color - - (struct-out var-id) - (struct-out shaped-parens) - (struct-out just-context) - (struct-out alternate-display) - (struct-out literal-syntax) - (for-syntax make-variable-id - variable-id? - make-element-id-transformer - element-id-transformer?)) - - (define (make-scheme-style s #:tt? [tt? #t]) - (make-style s (if tt? - (cons 'tt-chars scheme-properties) - scheme-properties))) - - (define-on-demand output-color (make-scheme-style "ScmOut")) - (define-on-demand input-color (make-scheme-style "ScmIn")) - (define-on-demand input-background-color (make-scheme-style "ScmInBG")) - (define-on-demand no-color (make-scheme-style "ScmPlain")) - (define-on-demand reader-color (make-scheme-style "ScmRdr")) - (define-on-demand result-color (make-scheme-style "ScmRes")) - (define-on-demand keyword-color (make-scheme-style "ScmKw")) - (define-on-demand comment-color (make-scheme-style "ScmCmt")) - (define-on-demand paren-color (make-scheme-style "ScmPn")) - (define-on-demand meta-color (make-scheme-style "ScmMeta")) - (define-on-demand value-color (make-scheme-style "ScmVal")) - (define-on-demand symbol-color (make-scheme-style "ScmSym")) - (define-on-demand variable-color (make-scheme-style "ScmVar")) - (define-on-demand opt-color (make-scheme-style "ScmOpt")) - (define-on-demand error-color (make-scheme-style "ScmErr" #:tt? #f)) - (define-on-demand syntax-link-color (make-scheme-style "ScmStxLink")) - (define-on-demand value-link-color (make-scheme-style "ScmValLink")) - (define-on-demand module-color (make-scheme-style "ScmMod")) - (define-on-demand module-link-color (make-scheme-style "ScmModLink")) - (define-on-demand block-color (make-scheme-style "ScmBlk")) - (define-on-demand highlighted-color (make-scheme-style "highlighted" #:tt? #f)) - - (define current-keyword-list - (make-parameter null)) - (define current-variable-list - (make-parameter null)) - (define current-meta-list - (make-parameter null)) - - (define defined-names (make-hasheq)) - - (define-struct (sized-element element) (length)) - - (define-struct (spaces element) (cnt)) - - (define (literalize-spaces i) - (let ([m (regexp-match-positions #rx" +" i)]) - (if m - (let ([cnt (- (cdar m) (caar m))]) - (make-spaces #f - (list - (literalize-spaces (substring i 0 (caar m))) - (hspace cnt) - (literalize-spaces (substring i (cdar m)))) - cnt)) - i))) - - - (define line-breakable-space (make-element 'tt " ")) - - ;; These caches intentionally record a key with the value. - ;; That way, when the value is no longer used, the key - ;; goes away, and the entry is gone. - - (define id-element-cache (make-weak-hash)) - (define element-cache (make-weak-hash)) - - (define-struct (cached-delayed-element delayed-element) (cache-key)) - (define-struct (cached-element element) (cache-key)) - - (define (make-id-element c s) - (let* ([key (and id-element-cache - (let ([b (identifier-label-binding c)]) - (vector (syntax-e c) - (module-path-index->taglet (caddr b)) - (cadddr b) - (list-ref b 5))))]) - (or (and key - (let ([b (hash-ref id-element-cache key #f)]) - (and b - (weak-box-value b)))) - (let ([e (make-cached-delayed-element - (lambda (renderer sec ri) - (let* ([tag (find-scheme-tag sec ri c #f)]) - (if tag - (list - (case (car tag) - [(form) - (make-link-element syntax-link-color (list s) tag)] - [else - (make-link-element value-link-color (list s) tag)])) - (list - (make-element "badlink" - (make-element value-link-color s)))))) - (lambda () s) - (lambda () s) - key)]) - (when key - (hash-set! id-element-cache key (make-weak-box e))) - e)))) - - (define (make-element/cache style content) - (if (and element-cache - (string? content)) - (let ([key (vector style content)]) - (let ([b (hash-ref element-cache key #f)]) - (or (and b (weak-box-value b)) - (let ([e (make-cached-element style content key)]) - (hash-set! element-cache key (make-weak-box e)) - e)))) - (make-element style content))) - - (define (to-quoted qs qq? quote-depth out color? inc!) - (if (and qq? (zero? quote-depth)) - (begin - (out qs (and color? value-color)) - (inc!) - (add1 quote-depth)) - quote-depth)) - - (define (to-unquoted qq? quote-depth out color? inc!) - (if (or (not qq?) (zero? quote-depth)) - quote-depth - (begin - (out "," (and color? meta-color)) - (inc!) - (to-unquoted qq? (sub1 quote-depth) out color? inc!)))) - - (define (typeset-atom c out color? quote-depth qq?) - (if (and (var-id? (syntax-e c)) - (zero? quote-depth)) - (out (format "~s" (let ([v (var-id-sym (syntax-e c))]) - (if (syntax? v) - (syntax-e v) - v))) - variable-color) - (let*-values ([(is-var?) (and (identifier? c) - (memq (syntax-e c) (current-variable-list)))] - [(s it? sub?) - (let ([sc (syntax-e c)]) - (let ([s (or (syntax-property c 'display-string) - (format "~s" (if (literal-syntax? sc) - (literal-syntax-stx sc) - (if (var-id? sc) - (var-id-sym sc) - sc))))]) - (if (and (symbol? sc) - ((string-length s) . > . 1) - (char=? (string-ref s 0) #\_) - (not (or (identifier-label-binding c) - is-var?))) - (values (substring s 1) #t #f) - (values s #f #f))))]) - (let ([quote-depth (if (and qq? (identifier? c)) - (let ([quote-depth - (if (and (quote-depth . < . 2) - (memq (syntax-e c) '(unquote unquote-splicing))) - (to-unquoted qq? quote-depth out color? void) - quote-depth)]) - (to-quoted "'" qq? quote-depth out color? void)) - quote-depth)]) - (if (or (element? (syntax-e c)) - (delayed-element? (syntax-e c)) - (part-relative-element? (syntax-e c))) - (out (syntax-e c) #f) - (out (if (and (identifier? c) - color? - (quote-depth . <= . 0) - (not (or it? is-var?))) - (if (pair? (identifier-label-binding c)) - (make-id-element c s) - s) - (literalize-spaces s)) - (cond - [(positive? quote-depth) value-color] - [(let ([v (syntax-e c)]) - (or (number? v) - (string? v) - (bytes? v) - (char? v) - (regexp? v) - (byte-regexp? v) - (boolean? v))) - value-color] - [(identifier? c) - (cond - [is-var? - variable-color] - [(and (identifier? c) - (memq (syntax-e c) (current-keyword-list))) - keyword-color] - [(and (identifier? c) - (memq (syntax-e c) (current-meta-list))) - meta-color] - [it? variable-color] - [else symbol-color])] - [else paren-color]) - (string-length s))))))) - - (define omitable (make-style #f '(omitable))) - - (define (gen-typeset c multi-line? prefix1 prefix suffix color? qq?) - (let* ([c (syntax-ize c 0 #:qq? qq?)] - [content null] - [docs null] - [first (syntax-case c (code:line) - [(code:line e . rest) #'e] - [else c])] - [init-col (or (syntax-column first) 0)] - [src-col init-col] - [inc-src-col (lambda () (set! src-col (add1 src-col)))] - [dest-col 0] - [highlight? #f] - [col-map (make-hash)] - [next-col-map (make-hash)] - [line (or (syntax-line first) 0)]) - (define (finish-line!) - (when multi-line? - (set! docs (cons (make-paragraph omitable (reverse content)) - docs)) - (set! content null))) - (define out - (case-lambda - [(v cls) - (out v cls (let sz-loop ([v v]) - (cond - [(string? v) (string-length v)] - [(list? v) (for/fold ([s 0]) ([v (in-list v)]) (+ s (sz-loop v)))] - [(sized-element? v) (sized-element-length v)] - [(element? v) - (sz-loop (element-content v))] - [(delayed-element? v) - (content-width v)] - [(part-relative-element? v) - (content-width v)] - [(spaces? v) - (+ (sz-loop (car (element-content v))) - (spaces-cnt v) - (sz-loop (caddr (element-content v))))] - [else 1])))] - [(v cls len) - (unless (equal? v "") - (cond - [(spaces? v) - (out (car (element-content v)) cls 0) - (out (cadr (element-content v)) #f 0) - (out (caddr (element-content v)) cls len)] - [(equal? v "\n") - (if multi-line? - (begin - (finish-line!) - (out prefix cls)) - (out " " cls))] - [else - (set! content (cons ((if highlight? - (lambda (c) - (make-element highlighted-color c)) - values) - (if (and color? cls) - (make-element/cache cls v) - v)) - content)) - (set! dest-col (+ dest-col len))]))])) - (define advance - (case-lambda - [(c init-line! delta) - (let ([c (+ delta (or (syntax-column c) 0))] - [l (syntax-line c)]) - (let ([new-line? (and l (l . > . line))]) - (when new-line? - (for ([i (in-range (- l line))]) - (out "\n" no-color)) - (set! line l) - (set! col-map next-col-map) - (set! next-col-map (make-hash)) - (init-line!)) - (let ([d-col (let ([def-val (+ dest-col (- c src-col))]) - (if new-line? - (hash-ref col-map c def-val) - def-val))]) - (let ([amt (- d-col dest-col)]) - (when (positive? amt) - (let ([old-dest-col dest-col]) - (out (if (and (= 1 amt) (not multi-line?)) - line-breakable-space ; allows a line break to replace the space - (hspace amt)) - #f) - (set! dest-col (+ old-dest-col amt)))))) - (set! src-col c) - (hash-set! next-col-map src-col dest-col)))] - [(c init-line!) (advance c init-line! 0)])) - (define (convert-infix c quote-depth qq?) - (let ([l (syntax->list c)]) - (and l - ((length l) . >= . 3) - ((or (syntax-position (car l)) -inf.0) - . > . - (or (syntax-position (cadr l)) +inf.0)) - (let ([a (car l)]) - (let loop ([l (cdr l)] - [prev null]) - (cond - [(null? l) #f] ; couldn't unwind - [else (let ([p2 (syntax-position (car l))]) - (if (and p2 - (p2 . > . (syntax-position a))) - (datum->syntax c - (append - (reverse prev) - (list - (datum->syntax - a - (let ([val? (positive? quote-depth)]) - (make-sized-element - (if val? value-color #f) - (list - (make-element/cache (if val? value-color paren-color) '". ") - (typeset a #f "" "" "" (not val?) qq?) - (make-element/cache (if val? value-color paren-color) '" .")) - (+ (syntax-span a) 4))) - (list (syntax-source a) - (syntax-line a) - (- (syntax-column a) 2) - (- (syntax-position a) 2) - (+ (syntax-span a) 4)) - a)) - l) - c - c) - (loop (cdr l) - (cons (car l) prev))))])))))) - (define (no-fancy-chars s) - (cond - [(eq? s 'rsquo) "'"] - [else s])) - (define (loop init-line! quote-depth qq?) - (lambda (c) - (cond - [(eq? 'code:blank (syntax-e c)) - (advance c init-line!)] - [(and (pair? (syntax-e c)) - (eq? (syntax-e (car (syntax-e c))) 'code:comment)) - (let ([l (syntax->list c)]) - (unless (and l (= 2 (length l))) - (raise-syntax-error - #f - "does not have a single sub-form" - c))) - (advance c init-line!) - (out ";" comment-color) - (out 'nbsp comment-color) - (let ([v (syntax->datum (cadr (syntax->list c)))]) - (if (paragraph? v) - (map (lambda (v) - (let ([v (no-fancy-chars v)]) - (if (or (string? v) (symbol? v)) - (out v comment-color) - (out v #f)))) - (paragraph-content v)) - (out (no-fancy-chars v) comment-color)))] - [(and (pair? (syntax-e c)) - (eq? (syntax-e (car (syntax-e c))) 'code:contract)) - (advance c init-line!) - (out "; " comment-color) - (let* ([l (cdr (syntax->list c))] - [s-col (or (syntax-column (car l)) src-col)]) - (set! src-col s-col) - (for-each (loop (lambda () - (set! src-col s-col) - (set! dest-col 0) - (out "; " comment-color)) - 0 - qq?) - l))] - [(and (pair? (syntax-e c)) - (eq? (syntax-e (car (syntax-e c))) 'code:line)) - (let ([l (cdr (syntax->list c))]) - (for-each (loop init-line! quote-depth qq?) - l))] - [(and (pair? (syntax-e c)) - (eq? (syntax-e (car (syntax-e c))) 'code:hilite)) - (let ([l (syntax->list c)] - [h? highlight?]) - (unless (and l (= 2 (length l))) - (error "bad code:redex: ~e" (syntax->datum c))) - (advance c init-line!) - (set! src-col (syntax-column (cadr l))) - (hash-set! next-col-map src-col dest-col) - (set! highlight? #t) - ((loop init-line! quote-depth qq?) (cadr l)) - (set! highlight? h?) - (set! src-col (add1 src-col)))] - [(and (pair? (syntax-e c)) - (eq? (syntax-e (car (syntax-e c))) 'code:quote)) - (advance c init-line!) - (let ([quote-depth (to-quoted "`" qq? quote-depth out color? inc-src-col)]) - (out "(" (if (positive? quote-depth) value-color paren-color)) - (set! src-col (+ src-col 1)) - (hash-set! next-col-map src-col dest-col) - ((loop init-line! quote-depth qq?) - (datum->syntax #'here 'quote (car (syntax-e c)))) - (for-each (loop init-line! (add1 quote-depth) qq?) - (cdr (syntax->list c))) - (out ")" (if (positive? quote-depth) value-color paren-color)) - (set! src-col (+ src-col 1)) - #; - (hash-set! next-col-map src-col dest-col))] - [(and (pair? (syntax-e c)) - (memq (syntax-e (car (syntax-e c))) - '(quote quasiquote unquote unquote-splicing - quasisyntax syntax unsyntax unsyntax-splicing)) - (let ([v (syntax->list c)]) - (and v (= 2 (length v)))) - (or (not qq?) - (quote-depth . > . 1) - (not (memq (syntax-e (car (syntax-e c))) - '(unquote unquote-splicing))))) - (advance c init-line!) - (let ([quote-depth (to-quoted "`" qq? quote-depth out color? inc-src-col)]) - (let-values ([(str quote-delta) - (case (syntax-e (car (syntax-e c))) - [(quote) (values "'" +inf.0)] - [(unquote) (values "," -1)] - [(unquote-splicing) (values ",@" -1)] - [(quasiquote) (values "`" +1)] - [(syntax) (values "#'" 0)] - [(quasisyntax) (values "#`" 0)] - [(unsyntax) (values "#," 0)] - [(unsyntax-splicing) (values "#,@" 0)])]) - (out str (if (positive? (+ quote-depth quote-delta)) - value-color - reader-color)) - (let ([i (cadr (syntax->list c))]) - (set! src-col (or (syntax-column i) src-col)) - (hash-set! next-col-map src-col dest-col) - ((loop init-line! (+ quote-depth quote-delta) qq?) i))))] - [(and (pair? (syntax-e c)) - (convert-infix c quote-depth qq?)) - => (lambda (converted) - ((loop init-line! quote-depth qq?) converted))] - [(or (pair? (syntax-e c)) - (null? (syntax-e c)) - (vector? (syntax-e c)) - (and (struct? (syntax-e c)) - (prefab-struct-key (syntax-e c))) - (struct-proxy? (syntax-e c))) - (let* ([sh (or (syntax-property c 'paren-shape) - #\()] - [quote-depth (if (and (not qq?) - (zero? quote-depth) - (or (vector? (syntax-e c)) - (struct? (syntax-e c)))) - +inf.0 - quote-depth)] - [p-color (if (positive? quote-depth) - value-color - (if (eq? sh #\?) - opt-color - paren-color))]) - (advance c init-line!) - (let ([quote-depth (if (struct-proxy? (syntax-e c)) - (to-unquoted qq? quote-depth out color? inc-src-col) - (to-quoted "`" qq? quote-depth out color? inc-src-col))]) - (when (vector? (syntax-e c)) - (let ([vec (syntax-e c)]) - (out "#" #;(format "#~a" (vector-length vec)) p-color) - (if (zero? (vector-length vec)) - (set! src-col (+ src-col (- (syntax-span c) 2))) - (set! src-col (+ src-col (- (syntax-column (vector-ref vec 0)) - (syntax-column c) - 1)))))) - (when (struct? (syntax-e c)) - (out "#s" p-color) - (set! src-col (+ src-col 2))) - (out (case sh - [(#\[ #\?) "["] - [(#\{) "{"] - [else "("]) - p-color) - (set! src-col (+ src-col 1)) - (hash-set! next-col-map src-col dest-col) - (let lloop ([l (cond - [(vector? (syntax-e c)) - (vector->short-list (syntax-e c) syntax-e)] - [(struct? (syntax-e c)) - (let ([l (vector->list (struct->vector (syntax-e c)))]) - ;; Need to build key datum, syntax-ize it internally, and - ;; set the overall width to fit right: - (cons (let ([key (syntax-ize (prefab-struct-key (syntax-e c)) - (+ 3 (or (syntax-column c) 0)) - (or (syntax-line c) 1))] - [end (if (pair? (cdr l)) - (and (equal? (syntax-line c) (syntax-line (cadr l))) - (syntax-column (cadr l))) - (and (syntax-column c) - (+ (syntax-column c) (syntax-span c))))]) - (if end - (datum->syntax #f - (syntax-e key) - (vector #f (syntax-line key) - (syntax-column key) - (syntax-position key) - (- end 1 (syntax-column key)))) - end)) - (cdr l)))] - [(struct-proxy? (syntax-e c)) - (cons - (struct-proxy-name (syntax-e c)) - (struct-proxy-content (syntax-e c)))] - [else c])] - [first-qq? (and qq? (not (struct-proxy? (syntax-e c))))]) - (cond - [(and (syntax? l) - (pair? (syntax-e l)) - (not (and (memq (syntax-e (car (syntax-e l))) - '(quote unquote syntax unsyntax quasiquote quasiunsyntax)) - (let ([v (syntax->list l)]) - (and v (= 2 (length v)))) - (or (not qq?) - (quote-depth . > . 1) - (not (memq (syntax-e (car (syntax-e l))) - '(unquote unquote-splicing))))))) - (lloop (syntax-e l) first-qq?)] - [(or (null? l) - (and (syntax? l) - (null? (syntax-e l)))) - (void)] - [(pair? l) - ((loop init-line! quote-depth first-qq?) (car l)) - (lloop (cdr l) qq?)] - [else - (advance l init-line! -2) - (out ". " (if (positive? quote-depth) value-color paren-color)) - (set! src-col (+ src-col 3)) - (hash-set! next-col-map src-col dest-col) - ((loop init-line! quote-depth first-qq?) l)])) - (out (case sh - [(#\[ #\?) "]"] - [(#\{) "}"] - [else ")"]) - p-color) - (set! src-col (+ src-col 1)) - #; - (hash-set! next-col-map src-col dest-col)))] - [(box? (syntax-e c)) - (advance c init-line!) - (let ([quote-depth (to-quoted "`" qq? quote-depth out color? inc-src-col)]) - (out "#&" value-color) - (set! src-col (+ src-col 2)) - (hash-set! next-col-map src-col dest-col) - ((loop init-line! (if qq? quote-depth +inf.0) qq?) (unbox (syntax-e c))))] - [(hash? (syntax-e c)) - (advance c init-line!) - (let ([equal-table? (not (hash-eq? (syntax-e c)))] - [quote-depth (to-quoted "`" qq? quote-depth out color? inc-src-col)]) - (out (if equal-table? - "#hash" - "#hasheq") - value-color) - (let ([delta (+ 5 (if equal-table? 2 0))] - [orig-col src-col]) - (set! src-col (+ src-col delta)) - (hash-set! next-col-map src-col dest-col) - ((loop init-line! (if qq? quote-depth +inf.0) qq?) - (syntax-ize (hash-map (syntax-e c) cons) - (+ (syntax-column c) delta))) - (set! src-col (+ orig-col (syntax-span c)))))] - [(graph-reference? (syntax-e c)) - (advance c init-line!) - (out (format "#~a#" (unbox (graph-reference-bx (syntax-e c)))) - (if (positive? quote-depth) - value-color - paren-color)) - (set! src-col (+ src-col (syntax-span c)))] - [(graph-defn? (syntax-e c)) - (advance c init-line!) - (let ([bx (graph-defn-bx (syntax-e c))]) - (out (format "#~a=" (unbox bx)) - (if (positive? quote-depth) - value-color - paren-color)) - (set! src-col (+ src-col 3)) - ((loop init-line! quote-depth qq?) (graph-defn-r (syntax-e c))))] - [else - (advance c init-line!) - (typeset-atom c out color? quote-depth qq?) - (set! src-col (+ src-col (or (syntax-span c) 1))) - #; - (hash-set! next-col-map src-col dest-col)]))) - (out prefix1 #f) - (set! dest-col 0) - (hash-set! next-col-map init-col dest-col) - ((loop (lambda () (set! src-col init-col) (set! dest-col 0)) 0 qq?) c) - (if (list? suffix) - (map (lambda (sfx) - (finish-line!) - (out sfx #f)) - suffix) - (out suffix #f)) - (unless (null? content) - (finish-line!)) - (if multi-line? - (if (= 1 (length docs)) - (car docs) - (make-table block-color (map list (reverse docs)))) - (make-sized-element #f (reverse content) dest-col)))) - - (define (typeset c multi-line? prefix1 prefix suffix color? qq?) - (let* ([c (syntax-ize c 0 #:qq? qq?)] - [s (syntax-e c)]) - (if (or multi-line? - (eq? 'code:blank s) - (pair? s) - (vector? s) - (struct? s) - (box? s) - (null? s) - (hash? s) - (graph-defn? s) - (graph-reference? s) - (struct-proxy? s)) - (gen-typeset c multi-line? prefix1 prefix suffix color? qq?) - (typeset-atom c - (letrec ([mk - (case-lambda - [(elem color) - (mk elem color (or (syntax-span c) 1))] - [(elem color len) - (if (and (string? elem) - (= len (string-length elem))) - (make-element/cache (and color? color) elem) - (make-sized-element (and color? color) elem len))])]) - mk) - color? 0 qq?)))) - - (define (to-element c #:qq? [qq? #f]) - (typeset c #f "" "" "" #t qq?)) - - (define (to-element/no-color c #:qq? [qq? #f]) - (typeset c #f "" "" "" #f qq?)) - - (define (to-paragraph c #:qq? [qq? #f]) - (typeset c #t "" "" "" #t qq?)) - - (define ((to-paragraph/prefix pfx1 pfx sfx) c #:qq? [qq? #f]) - (typeset c #t pfx1 pfx sfx #t qq?)) - - (begin-for-syntax - (define-struct variable-id (sym) - #:omit-define-syntaxes - #:property prop:procedure (lambda (self stx) - (raise-syntax-error - #f - (string-append - "misuse of an identifier (not in `scheme', etc.) that is" - " bound as a code-typesetting variable") - stx))) - (define-struct element-id-transformer (proc) - #:omit-define-syntaxes - #:property prop:procedure (lambda (self stx) - (raise-syntax-error - #f - (string-append - "misuse of an identifier (not in `scheme', etc.) that is" - " bound as an code-typesetting element transformer") - stx)))) - - (define-syntax (define-code stx) - (syntax-case stx () - [(_ code typeset-code uncode d->s stx-prop) - (syntax/loc stx - (define-syntax (code stx) - (define (wrap-loc v ctx e) - `(,#'d->s ,ctx - ,e - #(code - ,(syntax-line v) - ,(syntax-column v) - ,(syntax-position v) - ,(syntax-span v)))) - (define (stx->loc-s-expr v) - (let ([slv (and (identifier? v) - (syntax-local-value v (lambda () #f)))]) - (cond - [(variable-id? slv) - (wrap-loc v #f `(,#'make-var-id ',(variable-id-sym slv)))] - [(element-id-transformer? slv) - (wrap-loc v #f ((element-id-transformer-proc slv) v))] - [(syntax? v) - (let ([mk (wrap-loc - v - `(quote-syntax ,(datum->syntax v 'defcode)) - (syntax-case v (uncode) - [(uncode e) #'e] - [else (stx->loc-s-expr (syntax-e v))]))]) - (let ([prop (syntax-property v 'paren-shape)]) - (if prop - `(,#'stx-prop ,mk 'paren-shape ,prop) - mk)))] - [(null? v) 'null] - [(list? v) `(list . ,(map stx->loc-s-expr v))] - [(pair? v) `(cons ,(stx->loc-s-expr (car v)) - ,(stx->loc-s-expr (cdr v)))] - [(vector? v) `(vector ,@(map - stx->loc-s-expr - (vector->list v)))] - [(and (struct? v) (prefab-struct-key v)) - `(make-prefab-struct (quote ,(prefab-struct-key v)) - ,@(map - stx->loc-s-expr - (cdr (vector->list (struct->vector v)))))] - [(box? v) `(box ,(stx->loc-s-expr (unbox v)))] - [else `(quote ,v)]))) - (define (cvt s) - (datum->syntax #'here (stx->loc-s-expr s) #f)) - (if (eq? (syntax-local-context) 'expression) - (syntax-case stx () - [(_ expr) #`(typeset-code #,(cvt #'expr))] - [(_ expr (... ...)) - #`(typeset-code #,(cvt #'(code:line expr (... ...))))]) - (quasisyntax/loc stx - (#%expression #,stx)))))] - [(_ code typeset-code uncode d->s) - #'(define-code code typeset-code uncode d->s syntax-property)] - [(_ code typeset-code uncode) - #'(define-code code typeset-code uncode datum->syntax syntax-property)] - [(_ code typeset-code) #'(define-code code typeset-code unsyntax)])) - - - (define syntax-ize-hook (make-parameter (lambda (v col) #f))) - - (define (vector->short-list v extract) - (vector->list v) - #; - (let ([l (vector->list v)]) - (reverse (list-tail - (reverse l) - (- (vector-length v) - (let loop ([i (sub1 (vector-length v))]) - (cond - [(zero? i) 1] - [(eq? (extract (vector-ref v i)) - (extract (vector-ref v (sub1 i)))) - (loop (sub1 i))] - [else (add1 i)]))))))) - - (define (short-list->vector v l) - (list->vector - (let ([n (length l)]) - (if (n . < . (vector-length v)) - (reverse (let loop ([r (reverse l)][i (- (vector-length v) n)]) - (if (zero? i) - r - (loop (cons (car r) r) (sub1 i))))) - l)))) - - (define-struct var-id (sym)) - (define-struct shaped-parens (val shape)) - (define-struct just-context (val ctx)) - (define-struct alternate-display (id string)) - (define-struct literal-syntax (stx)) - (define-struct struct-proxy (name content)) - - (define-struct graph-reference (bx)) - (define-struct graph-defn (r bx)) - - (define (syntax-ize v col [line 1] #:qq? [qq? #f]) - (do-syntax-ize v col line (box #hasheq()) #f (and qq? 0))) - - (define (graph-count ht graph?) - (and graph? - (let ([n (hash-ref (unbox ht) '#%graph-count 0)]) - (set-box! ht (hash-set (unbox ht) '#%graph-count (add1 n))) - n))) - - (define (do-syntax-ize v col line ht graph? qq) - (cond - [((syntax-ize-hook) v col) - => (lambda (r) r)] - [(shaped-parens? v) - (syntax-property (do-syntax-ize (shaped-parens-val v) col line ht #f qq) - 'paren-shape - (shaped-parens-shape v))] - [(just-context? v) - (let ([s (do-syntax-ize (just-context-val v) col line ht #f qq)]) - (datum->syntax (just-context-ctx v) - (syntax-e s) - s - s - (just-context-ctx v)))] - [(alternate-display? v) - (let ([s (do-syntax-ize (alternate-display-id v) col line ht #f qq)]) - (syntax-property s - 'display-string - (alternate-display-string v)))] - [(hash-ref (unbox ht) v #f) - => (lambda (m) - (unless (unbox m) - (set-box! m #t)) - (datum->syntax #f - (make-graph-reference m) - (vector #f line col (+ 1 col) 1)))] - [(and (list? v) - (pair? v) - (let ([s (let ([s (car v)]) - (if (just-context? s) - (just-context-val s) - s))]) - (and - (or (memq s '(quaisquote quote)) - (and (memq s '(unquote unquote-splicing)) - (or (not qq) - (qq . > . 2)))) - s))) - => (lambda (s) - (let ([c (do-syntax-ize (cadr v) (+ col 1) line ht #f qq)]) - (datum->syntax #f - (list (do-syntax-ize (car v) col line ht #f - (and qq - (case s - [(quaisquote) (add1 qq)] - [(unquote unquote-splicing) (sub1 qq)] - [else qq]))) - c) - (vector #f line col (+ 1 col) - (+ 1 (syntax-span c))))))] - [(or (list? v) - (vector? v) - (and (struct? v) - (or (and qq - ;; Watch out for partially transparent subtypes of `element': - (not (element? v))) - (prefab-struct-key v)))) - (let ([orig-ht (unbox ht)] - [graph-box (box (graph-count ht graph?))] - [qq (and qq (max 1 qq))]) - (set-box! ht (hash-set (unbox ht) v graph-box)) - (let* ([graph-sz (if graph? - (+ 2 (string-length (format "~a" (unbox graph-box)))) - 0)] - [vec-sz (cond - [(vector? v) - (+ 1 #;(string-length (format "~a" (vector-length v))))] - [(struct? v) - (if (prefab-struct-key v) - 2 - 0)] - [else 0])] - [r (let ([l (let loop ([col (+ col 1 vec-sz graph-sz)] - [v (cond - [(vector? v) - (vector->short-list v values)] - [(struct? v) - (cons (let ([pf (prefab-struct-key v)]) - (if pf - (prefab-struct-key v) - (object-name v))) - (cdr (vector->list (struct->vector v))))] - [else v])]) - (if (null? v) - null - (let ([i (do-syntax-ize (car v) col line ht #f qq)]) - (cons i - (loop (+ col 1 (syntax-span i)) (cdr v))))))]) - (datum->syntax #f - (cond - [(vector? v) (short-list->vector v l)] - [(struct? v) - (let ([pf (prefab-struct-key v)]) - (if pf - (apply make-prefab-struct (prefab-struct-key v) (cdr l)) - (make-struct-proxy (car l) (cdr l))))] - [else l]) - (vector #f line - (+ graph-sz col) - (+ 1 graph-sz col) - (+ 2 - vec-sz - (if (zero? (length l)) - 0 - (sub1 (length l))) - (apply + (map syntax-span l))))))]) - (unless graph? - (set-box! ht (hash-set (unbox ht) v #f))) - (cond - [graph? (datum->syntax #f - (make-graph-defn r graph-box) - (vector #f (syntax-line r) - (- (syntax-column r) graph-sz) - (- (syntax-position r) graph-sz) - (+ (syntax-span r) graph-sz)))] - [(unbox graph-box) - ;; Go again, this time knowing that there will be a graph: - (set-box! ht orig-ht) - (do-syntax-ize v col line ht #t qq)] - [else r])))] - [(pair? v) - (let ([orig-ht (unbox ht)] - [graph-box (box (graph-count ht graph?))] - [qq (and qq (max 1 qq))]) - (set-box! ht (hash-set (unbox ht) v graph-box)) - (let* ([inc (if graph? - (+ 2 (string-length (format "~a" (unbox graph-box)))) - 0)] - [a (do-syntax-ize (car v) (+ col 1 inc) line ht #f qq)] - [sep (if (and (pair? (cdr v)) - ;; FIXME: what if it turns out to be a graph reference? - (not (hash-ref (unbox ht) (cdr v) #f))) - 0 - 3)] - [b (do-syntax-ize (cdr v) (+ col 1 inc (syntax-span a) sep) line ht #f qq)]) - (let ([r (datum->syntax #f - (cons a b) - (vector #f line (+ col inc) (+ 1 col inc) - (+ 2 sep (syntax-span a) (syntax-span b))))]) - (unless graph? - (set-box! ht (hash-set (unbox ht) v #f))) - (cond - [graph? (datum->syntax #f - (make-graph-defn r graph-box) - (vector #f line col (+ 1 col) - (+ inc (syntax-span r))))] - [(unbox graph-box) - ;; Go again... - (set-box! ht orig-ht) - (do-syntax-ize v col line ht #t qq)] - [else r]))))] - [(box? v) - (let ([a (do-syntax-ize (unbox v) (+ col 2) line ht #f (and qq (max 1 qq)))]) - (datum->syntax #f - (box a) - (vector #f line col (+ 1 col) - (+ 2 (syntax-span a)))))] - [else - (datum->syntax #f v (vector #f line col (+ 1 col) 1))]))) +#lang racket/base +(require "racket.ss") +(provide (all-from-out "racket.ss")) diff --git a/collects/scribblings/main/getting-started.scrbl b/collects/scribblings/main/getting-started.scrbl index ea370a7189..3faf230554 100644 --- a/collects/scribblings/main/getting-started.scrbl +++ b/collects/scribblings/main/getting-started.scrbl @@ -8,11 +8,12 @@ through a textbook: @itemize[ - @item{@italic{@link["http:///www.htdp.org/"]{How to - Design Programs}} is the best place to start.} + @item{@italic{@link["http:///www.htdp.org/"]{How to Design Programs}} + is the best place to start. Whenever the book says ``Scheme,'' + you can read it as ``Racket.''} @item{@other-manual['(lib "web-server/scribblings/tutorial/continue.scrbl")] - introduces you to the Module language and building web applications.} + introduces you to modules and building web applications.} @item{@other-manual['(lib "scribblings/guide/guide.scrbl")] describes the rest of the Racket language, which is much bigger than diff --git a/collects/scribblings/reference/eval-model.scrbl b/collects/scribblings/reference/eval-model.scrbl index b0692ded20..d4c706fc3d 100644 --- a/collects/scribblings/reference/eval-model.scrbl +++ b/collects/scribblings/reference/eval-model.scrbl @@ -1,6 +1,6 @@ #lang scribble/doc @(require scribble/struct - scribble/scheme + scribble/racket (for-syntax racket/base) "mz.ss" "prog-steps.ss") @@ -11,13 +11,13 @@ @(define *redex (lambda (c) (make-element highlighted-color (list c)))) @(define-syntax redex - (syntax-rules () [(_ a) (*redex (scheme a))])) + (syntax-rules () [(_ a) (*redex (racket a))])) @(define hole (make-element #f (list "[]"))) @(define (*sub c e) (make-element #f (list c "[" e "]"))) @(define-syntax sub - (syntax-rules () [(_ a b) (*sub (scheme a) (scheme b))])) + (syntax-rules () [(_ a b) (*sub (racket a) (racket b))])) @(define (frame n) (make-element variable-color (list "C" (make-element 'subscript (list (format "~a" n)))))) @@ -29,21 +29,21 @@ to switch to the usual langle/rangle that is used in syntax definitions. @(define comma (make-element 'tt (list ", "))) @(define (*state c e) (make-element #f (list langle c comma e rangle))) @(define-syntax state - (syntax-rules () [(_ a b) (*state (scheme a) (scheme b))])) + (syntax-rules () [(_ a b) (*state (racket a) (racket b))])) ;} @;------------------------------------------------------------------------ @title[#:tag "eval-model"]{Evaluation Model} -Scheme evaluation can be viewed as the simplification of expressions +Racket evaluation can be viewed as the simplification of expressions to obtain values. For example, just as an elementary-school student simplifies @verbatim{ 1 + 1 = 2} -Scheme evaluation simplifies +Racket evaluation simplifies -@schemeblock[ +@racketblock[ (+ 1 1) @#,reduces 2 ] @@ -51,14 +51,14 @@ The arrow @reduces above replaces the more traditional @tt{=} to emphasize that evaluation proceeds in a particular direction towards simpler expressions. In particular, a @deftech{value} is an expression that evaluation simplifies no further, such as the number -@scheme[2]. +@racket[2]. @;------------------------------------------------------------------------ @section[#:tag "cont-model"]{Sub-expression Evaluation and Continuations} Some simplifications require more than one step. For example: -@schemeblock[ +@racketblock[ (- 4 #,(redex (+ 1 1))) #,reduces #,(redex (- 4 2)) #,reduces 2 ] @@ -66,15 +66,15 @@ An expression that is not a @tech{value} can always be partitioned 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 +context. In @racket[(- 4 (+ 1 1))], the redex is @racket[(+ 1 1)], and +the continuation is @racket[(- 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}. Before some things can be evaluated, some sub-expressions must be -evaluated; for example, in the application @scheme[(- 4 (+ 1 1))], the -application of @scheme[-] cannot be reduced until the sub-expression -@scheme[(+ 1 1)] is reduced. +evaluated; for example, in the application @racket[(- 4 (+ 1 1))], the +application of @racket[-] cannot be reduced until the sub-expression +@racket[(+ 1 1)] is reduced. Thus, the specification of each syntactic form specifies how (some of) its sub-expressions are evaluated, and then how the results are @@ -86,65 +86,65 @@ evaluation steps during which an expression contains the @tech{redex}. @;------------------------------------------------------------------------ @section{Tail Position} -An expression @scheme[_expr1] is in @deftech{tail position} with -respect to an enclosing expression @scheme[_expr2] if, whenever -@scheme[_expr1] becomes a redex, its @tech{continuation} is the same -as was the enclosing @scheme[_expr2]'s @tech{continuation}. +An expression @racket[_expr1] is in @deftech{tail position} with +respect to an enclosing expression @racket[_expr2] if, whenever +@racket[_expr1] becomes a redex, its @tech{continuation} is the same +as was the enclosing @racket[_expr2]'s @tech{continuation}. -For example, the @scheme[(+ 1 1)] expression is @italic{not} in @tech{tail -position} with respect to @scheme[(- 4 (+ 1 1))]. To illustrate, we use +For example, the @racket[(+ 1 1)] expression is @italic{not} in @tech{tail +position} with respect to @racket[(- 4 (+ 1 1))]. To illustrate, we use the notation @sub[_C _expr] to mean the expression that is produced by -substituting @scheme[_expr] in place of @hole in the @tech{continuation} -@scheme[_C]: +substituting @racket[_expr] in place of @hole in the @tech{continuation} +@racket[_C]: -@schemeblock[ +@racketblock[ @#,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]. +In this case, the @tech{continuation} for reducing @racket[(+ 1 1)] is +@sub[_C (+ 4 @#,hole)], not just @racket[_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], +In contrast, @racket[(+ 1 1)] is in @tech{tail position} with respect +to @racket[(if (zero? 0) (+ 1 1) 3)], because, for any continuation +@racket[_C], -@schemeblock[ +@racketblock[ @#,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 -@scheme[if], and they do not depend on the @tech{continuation} -@scheme[_C]. The ``then'' branch of an @scheme[if] form is always in -@tech{tail position} with respect to the @scheme[if] form. Due to a -similar reduction rule for @scheme[if] and @scheme[#f], the ``else'' -branch of an @scheme[if] form is also in @tech{tail position}. +@racket[if], and they do not depend on the @tech{continuation} +@racket[_C]. The ``then'' branch of an @racket[if] form is always in +@tech{tail position} with respect to the @racket[if] form. Due to a +similar reduction rule for @racket[if] and @racket[#f], the ``else'' +branch of an @racket[if] form is also in @tech{tail position}. @tech{Tail-position} specifications provide a guarantee about the asymptotic space consumption of a computation. In general, the specification of @tech{tail positions} goes with each syntactic form, -like @scheme[if]. +like @racket[if]. @;------------------------------------------------------------------------ @section[#:tag "values-model"]{Multiple Return Values} -A Scheme expression can evaluate to @deftech{multiple values}, in the +A Racket expression can evaluate to @deftech{multiple values}, in the 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[(+ +@tech{values}. Indeed, most @tech{continuations}, such as @racket[(+ @#,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 +@racket[(let-values ([(x y) @#,hole]) _expr)] expects two result +@tech{values}; the first result replaces @racket[x] in the body +@racket[_expr], and the second replaces @racket[y] in +@racket[_expr]. The @tech{continuation} @racket[(begin @#,hole (+ 1 2))] accepts any number of result @tech{values}, because it ignores the result(s). In general, the specification of a syntactic form inidicates the number of @tech{values} that it produces and the number that it expects from each of its sub-expression. In addtion, some procedures -(notably @scheme[values]) produce multiple @tech{values}, and some -procedures (notably @scheme[call-with-values]) create continuations +(notably @racket[values]) produce multiple @tech{values}, and some +procedures (notably @racket[call-with-values]) create continuations internally that accept a certain number of @tech{values}. @;------------------------------------------------------------------------ @@ -158,28 +158,28 @@ then an algebra student simplifies @tt{x + 1} as follows: @verbatim{ x + 1 = 10 + 1 = 11} -Scheme works much the same way, in that a set of @tech{top-level +Racket works much the same way, in that a set of @tech{top-level variables} are available for substitutions on demand during evaluation. For example, given -@schemeblock[ +@racketblock[ (define x 10) ] then -@schemeblock[ +@racketblock[ #,(redex (+ x 1)) #,reduces #,(redex (+ 10 1)) #,reduces 11 ] -In Scheme, the way definitions appear is just as important as the way -that they are used. Scheme evaluation thus keeps track of both +In Racket, the way definitions appear is just as important as the way +that they are used. Racket evaluation thus keeps track of both definitions and the current expression, and it extends the set of -definitions in response to evaluating forms such as @scheme[define]. +definitions in response to evaluating forms such as @racket[define]. Each evaluation step, then, takes the current set of definitions and program to a new set of definitions and program. Before a -@scheme[define] can be moved into the set of definitions, its +@racket[define] can be moved into the set of definitions, its right-hand expression must be reduced to a @tech{value}. @prog-steps/no-obj[ @@ -197,7 +197,7 @@ right-hand expression must be reduced to a @tech{value}. 11] ] -Using @scheme[set!], a program can change the value associated with an +Using @racket[set!], a program can change the value associated with an existing @tech{top-level variable}: @prog-steps/no-obj[ @@ -214,9 +214,9 @@ existing @tech{top-level variable}: @;------------------------------------------------------------------------ @section{Objects and Imperative Update} -In addition to @scheme[set!] for imperative update of @tech{top-level +In addition to @racket[set!] for imperative update of @tech{top-level variables}, various procedures enable the modification of elements -within a compound data structure. For example, @scheme[vector-set!] +within a compound data structure. For example, @racket[vector-set!] modifies the content of a vector. To allow such modifications to data, we must distingiush between @@ -224,16 +224,16 @@ To allow such modifications to data, we must distingiush between @deftech{objects}, which hold the data referenced by a value. A few kinds of @tech{objects} can serve directly as values, including -booleans, @scheme[(void)], and small exact integers. More generally, +booleans, @racket[(void)], and small exact integers. More generally, however, a @tech{value} is a reference to an @tech{object}. For example, a @tech{value} can be a reference to a particular vector that -currently holds the value @scheme[10] in its first slot. If an +currently holds the value @racket[10] in its first slot. If an @tech{object} is modified, then the modification is visible through all copies of the @tech{value} that reference the same @tech{object}. In the evaluation model, a set of @tech{objects} must be carried along with each step in evaluation, just like the definition set. Operations -that create @tech{objects}, such as @scheme[vector], add to the set of +that create @tech{objects}, such as @racket[vector], add to the set of @tech{objects}: @prog-steps[ @@ -306,35 +306,35 @@ reference is crucial. A @tech{top-level variable} is not a value is extracted from the current set of definitions. An object reference, in contrast is a value, and therefore needs no further evaluation. The model evaluation steps above use angle-bracketed -@scheme[] for an object reference to distinguish it from a +@racket[] for an object reference to distinguish it from a @tech{variable} name. A direct object reference can never appear in a text-based source program. A program representation created with -@scheme[datum->syntax-object], however, can embed direct references to +@racket[datum->syntax], however, can embed direct references to existing @tech{objects}. @;------------------------------------------------------------------------ @section[#:tag "model-eq"]{Object Identity and Comparisons} -The @scheme[eq?] operator compares two @tech{values}, returning -@scheme[#t] when the values refer to the same @tech{object}. This form +The @racket[eq?] operator compares two @tech{values}, returning +@racket[#t] when the values refer to the same @tech{object}. This form of equality is suitable for comparing objects that support imperative update (e.g., to determine that the effect of modifying an object through one reference is visible through another reference). Also, an -@scheme[eq?] test evaluates quickly, and @scheme[eq?]-based hashing -is more lightweight than @scheme[equal?]-based hashing in hash tables. +@racket[eq?] test evaluates quickly, and @racket[eq?]-based hashing +is more lightweight than @racket[equal?]-based hashing in hash tables. -In some cases, however, @scheme[eq?] is unsuitable as a comparison +In some cases, however, @racket[eq?] is unsuitable as a comparison operator, because the generation of @tech{objects} is not clearly -defined. In particular, two applications of @scheme[+] to the same two -exact integers may or may not produce results that are @scheme[eq?], -although the results are always @scheme[equal?]. Similarly, evaluation -of a @scheme[lambda] form typically generates a new procedure +defined. In particular, two applications of @racket[+] to the same two +exact integers may or may not produce results that are @racket[eq?], +although the results are always @racket[equal?]. Similarly, evaluation +of a @racket[lambda] form typically generates a new procedure @tech{object}, but it may re-use a procedure @tech{object} previously -generated by the same source @scheme[lambda] form. +generated by the same source @racket[lambda] form. -The behavior of a datatype with respect to @scheme[eq?] is generally +The behavior of a datatype with respect to @racket[eq?] is generally specified with the datatype and its associated procedures. @;------------------------------------------------------------------------ @@ -352,9 +352,9 @@ In the program state (+ 1 x)] ] -evaluation cannot depend on @scheme[], because it is not part of +evaluation cannot depend on @racket[], because it is not part of the program to evaluate, and it is not referenced by any definition -that is accessible in the program. The @tech{object} @scheme[] may +that is accessible in the program. The @tech{object} @racket[] may therefore be removed from the evaluation by @deftech{garbage collection}. @@ -364,17 +364,17 @@ collector in determining which @tech{objects} are reachable for the remainder of the computation. If an @tech{object} is reachable only via a @tech{weak reference}, then the object can be reclaimed, and the @tech{weak reference} is replaced by a different @tech{value} -(typically @scheme[#f]). +(typically @racket[#f]). As a special case, a @tech{fixnum} is always considered reachable by the garbage collector. Many other values are always reachable due to the way they are implemented and used: A @tech{character} in the -Latin-1 range is always reachable, because @scheme[equal?] Latin-1 -characters are always @scheme[eq?], and all of the Latin-1 characters -are referenced by an internal module. Similarly, @scheme[null], -@scheme[#t], @scheme[#f], @scheme[eof], and @|void-const| and are -always reachable. Values produced by @scheme[quote] remain reachable -when the @scheme[quote] expression itself is reachable. +Latin-1 range is always reachable, because @racket[equal?] Latin-1 +characters are always @racket[eq?], and all of the Latin-1 characters +are referenced by an internal module. Similarly, @racket[null], +@racket[#t], @racket[#f], @racket[eof], and @|void-const| and are +always reachable. Values produced by @racket[quote] remain reachable +when the @racket[quote] expression itself is reachable. @;------------------------------------------------------------------------ @section{Procedure Applications and Local Variables} @@ -391,8 +391,8 @@ The key step in this simplification is take the body of the defined function @tt{f}, and then replace each @tt{x} with the actual @tech{value} @tt{1}. -Scheme procedure application works much the same way. A procedure is -an @tech{object}, so evaluating @scheme[(f 7)] starts with a +Racket procedure application works much the same way. A procedure is +an @tech{object}, so evaluating @racket[(f 7)] starts with a @tech{variable} lookup: @prog-steps[ @@ -406,9 +406,9 @@ an @tech{object}, so evaluating @scheme[(f 7)] starts with a Unlike in algebra, however, the @tech{value} associated with an argument can be changed in the body of a procedure by using -@scheme[set!], as in the example @scheme[(lambda (x) (begin (set! x 3) -x))]. Since the @tech{value} associated with @scheme[x] can be -changed, an actual value for cannot be substituted for @scheme[x] when +@racket[set!], as in the example @racket[(lambda (x) (begin (set! x 3) +x))]. Since the @tech{value} associated with @racket[x] can be +changed, an actual value for cannot be substituted for @racket[x] when the procedure is applied. Instead, a new @deftech{location} is created for each @tech{variable} @@ -439,10 +439,10 @@ a @tech{location} is generated, it (conceptually) uses a name that has not been used before and that cannot not be generated again or accessed directly. -Generating a @tech{location} in this way means that @scheme[set!] +Generating a @tech{location} in this way means that @racket[set!] evaluates for @tech{local variables} in the same way as for @tech{top-level variables}, because the @tech{local variable} is -always replaced with a @tech{location} by the time the @scheme[set!] +always replaced with a @tech{location} by the time the @racket[set!] form is evaluated: @prog-steps[ @@ -472,16 +472,16 @@ form is evaluated: The substitution and @tech{location}-generation step of procedure application requires that the argument is a @tech{value}. Therefore, -in @scheme[((lambda (x) (+ x 10)) (+ 1 2))], the @scheme[(+ 1 2)] -sub-expression must be simplified to the @tech{value} @scheme[3], and -then @scheme[3] can be placed into a @tech{location} for -@scheme[x]. In other words, Scheme is a @deftech{call-by-value} +in @racket[((lambda (x) (+ x 10)) (+ 1 2))], the @racket[(+ 1 2)] +sub-expression must be simplified to the @tech{value} @racket[3], and +then @racket[3] can be placed into a @tech{location} for +@racket[x]. In other words, Racket is a @deftech{call-by-value} language. -Evaluation of a local-variable form, such as @scheme[(let ([x (+ 1 -2)]) _expr)], is the same as for a procedure call. After @scheme[(+ 1 +Evaluation of a local-variable form, such as @racket[(let ([x (+ 1 +2)]) _expr)], is the same as for a procedure call. After @racket[(+ 1 2)] produces a @tech{value}, it is stored in a fresh @tech{location} -that replaces every instance of @scheme[x] in @scheme[_expr]. +that replaces every instance of @racket[x] in @racket[_expr]. @;------------------------------------------------------------------------ @section{Variables and Locations} @@ -498,20 +498,20 @@ through different instantiations. For example, in the program -@schemeblock[(define y (+ (let ([x 5]) x) 6))] +@racketblock[(define y (+ (let ([x 5]) x) 6))] -both @scheme[y] and @scheme[x] are @tech{variables}. The @scheme[y] -@tech{variable} is a @tech{top-level variable}, and the @scheme[x] is +both @racket[y] and @racket[x] are @tech{variables}. The @racket[y] +@tech{variable} is a @tech{top-level variable}, and the @racket[x] is a @tech{local variable}. When this code is evaluated, a -@tech{location} is created for @scheme[x] to hold the value -@scheme[5], and a @tech{location} is also created for @scheme[y] to -hold the value @scheme[6]. +@tech{location} is created for @racket[x] to hold the value +@racket[5], and a @tech{location} is also created for @racket[y] to +hold the value @racket[6]. The replacement of a @tech{variable} with a @tech{location} during -evaluation implements Scheme's @deftech{lexical scoping}. For example, -when a procedure-argument @tech{variable} @scheme[x] is replaced by -the @tech{location} @scheme[xloc], then it is replaced throughout the -body of the procedure, including with any nested @scheme[lambda] +evaluation implements Racket's @deftech{lexical scoping}. For example, +when a procedure-argument @tech{variable} @racket[x] is replaced by +the @tech{location} @racket[xloc], then it is replaced throughout the +body of the procedure, including with any nested @racket[lambda] forms. As a result, future references of the @tech{variable} always access the same @tech{location}. @@ -520,7 +520,7 @@ access the same @tech{location}. @margin-note/ref{See @secref["module"] for the syntax of modules.} -Most definitions in PLT Scheme are in modules. In terms of evaluation, +Most definitions in Racket are in modules. In terms of evaluation, a module is essentially a prefix on a defined name, so that different modules can define the name. That is, a @deftech{module-level variable} is like a @tech{top-level variable} from the perspective of @@ -528,57 +528,57 @@ evaluation. One difference between a module and a top-level definition is that a module can be declared without instantiating its module-level -definitions. Evaluation of a @scheme[require] @deftech{instantiates} +definitions. Evaluation of a @racket[require] @deftech{instantiates} (i.e., triggers the @deftech{instantiation} of) a declared module, which creates variables that correspond to its module-level definitions. For example, given the module declaration -@schemeblock[ -(module m scheme +@racketblock[ +(module m racket (define x 10)) ] -the evaluation of @scheme[(require m)] creates the variable @scheme[x] -and installs @scheme[10] as its value. This @scheme[x] is unrelated to -any top-level definition of @scheme[x]. +the evaluation of @racket[(require m)] creates the variable @racket[x] +and installs @racket[10] as its value. This @racket[x] is unrelated to +any top-level definition of @racket[x]. @;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @subsection[#:tag "module-phase"]{Phases} A module can be @tech{instantiate}d in multiple @deftech{phases}. A phase is an integer that, again, is effectively a prefix on the names -of module-level definitions. A top-level @scheme[require] +of module-level definitions. A top-level @racket[require] @tech{instantiates} a module at @tech{phase} 0, if the module is not already @tech{instantiate}d at phase 0. A top-level -@scheme[(require (for-syntax ....))] @tech{instantiates} a module at +@racket[(require (for-syntax ....))] @tech{instantiates} a module at @tech{phase} 1 (if it is not already @tech{instantiate}d at that -level); @scheme[for-syntax] also has a different binding +level); @racket[for-syntax] also has a different binding effect on further program parsing, as described in @secref["intro-binding"]. Within a module, some definitions are shifted by a phase already; the -@scheme[define-for-syntax] form is like @scheme[define], but it +@racket[define-for-syntax] form is like @racket[define], but it defines a variable at relative @tech{phase} 1, instead of relative @tech{phase} 0. Thus, if the module is @tech{instantiate}d at phase 1, -the variables for @scheme[define-for-syntax] are created at phase 2, +the variables for @racket[define-for-syntax] are created at phase 2, and so on. Moreover, this relative phase acts as another layer of -prefixing, so that a @scheme[define] of @scheme[x] and a -@scheme[define-for-syntax] of @scheme[x] can co-exist in a module +prefixing, so that a @racket[define] of @racket[x] and a +@racket[define-for-syntax] of @racket[x] can co-exist in a module without colliding. Again, the higher phases are mainly related to program parsing, instead of normal evaluation. If a module @tech{instantiate}d at @tech{phase} @math{n} -@scheme[require]s another module, then the @scheme[require]d module is +@racket[require]s another module, then the @racket[require]d module is first @tech{instantiate}d at phase @math{n}, and so on -transitively. (Module @scheme[require]s cannot form cycles.) If a -module @tech{instantiate}d at phase @math{n} @scheme[require]s -@scheme[for-syntax] another module, the other module becomes +transitively. (Module @racket[require]s cannot form cycles.) If a +module @tech{instantiate}d at phase @math{n} @racket[require]s +@racket[for-syntax] another module, the other module becomes @deftech{available} at @tech{phase} @math{n+1}, and it may later be @tech{instantiate}d at @tech{phase} @math{n+1}. If a module that is -@tech{available} at phase @math{n} for @math{n>0} @scheme[require]s -@scheme[for-template] another module, the other module becomes +@tech{available} at phase @math{n} for @math{n>0} @racket[require]s +@racket[for-template] another module, the other module becomes @tech{available} at @tech{phase} @math{n-1}, and so on. @tech{Instantiation}s of @tech{available} modules above @tech{phase} 0 are triggered on demand as described in @@ -591,11 +591,11 @@ module forms (see @secref["mod-parse"]), and are, again, conceptually distinguished by prefixes. Top-level variables can exist in multiple phases in the same way as -within modules. For example, @scheme[define-for-syntax] creates a +within modules. For example, @racket[define-for-syntax] creates a @tech{phase} 1 variable. Furthermore, reflective operations like -@scheme[make-base-namespace] and @scheme[eval] provide access to +@racket[make-base-namespace] and @racket[eval] provide access to top-level variables in higher @tech{phases}, while module -@tech{instantiations} (triggered by with @scheme[require]) relative to such +@tech{instantiations} (triggered by with @racket[require]) relative to such top-levels are in corresponding higher @tech{phase}s. @;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -620,9 +620,9 @@ re-declared, each re-declaration of the module is immediately @margin-note/ref{See @secref["contmarks"] for continuation-mark forms and functions.} -Every continuation @scheme[_C] can be partitioned into +Every continuation @racket[_C] can be partitioned into @deftech{continuation frames} @frame[1], @frame[2], ..., @frame["n"] -such that @scheme[_C] = @*sub[@frame[1] @*sub[@frame[2] @*sub["..." +such that @racket[_C] = @*sub[@frame[1] @*sub[@frame[2] @*sub["..." @frame["n"]]]], and no frame @frame["i"] can be itself partitioned into smaller continuations. Evaluation steps add and remove frames to the current continuation, typically one at a time. @@ -675,13 +675,13 @@ escape-continuation aborts can cross continuation barriers. @margin-note/ref{See @secref["concurrency"] for thread and synchronization functions.} -Scheme supports multiple @deftech{threads} of evaluation. Threads run +Racket supports multiple @deftech{threads} of evaluation. Threads run concurrently, in the sense that one thread can preempt another without its cooperation, but threads currently all run on the same processor (i.e., the same underlying OS process and thread). See also @secref["futures"]. -Threads are created explicitly by functions such as @scheme[thread]. +Threads are created explicitly by functions such as @racket[thread]. In terms of the evaluation model, each step in evaluation actually consists of multiple concurrent expressions, up to one per thread, rather than a single expression. The expressions all share the same objects and top-level variables, so that they can @@ -705,7 +705,7 @@ is created) as all other threads. @margin-note/ref{See @secref["parameters"] for parameter forms and functions.} -@deftech{Parameters} are essentially a derived concept in Scheme; they +@deftech{Parameters} are essentially a derived concept in Racket; they are defined in terms of @tech{continuation marks} and @tech{thread cells}. However, parameters are also built in, in the sense that some primitive procedures consult parameter values. For example, the @@ -726,8 +726,8 @@ preserved thread cell, and the combination of thread cell and current thread yields the parameter's value. A parameter procedure sets or accesses the relevant thread cell for its parameter. -Various operations, such as @scheme[parameterize] or -@scheme[call-with-parameterization], install a parameterization into +Various operations, such as @racket[parameterize] or +@racket[call-with-parameterization], install a parameterization into the current continuation's frame. @;------------------------------------------------------------------------ @@ -735,7 +735,7 @@ the current continuation's frame. @margin-note/ref{See @secref["exns"] for exception forms, functions, and types.} -@deftech{Exceptions} are essentially a derived concept in Scheme; they +@deftech{Exceptions} are essentially a derived concept in Racket; they are defined in terms of continuations, prompts, and continuation marks. However, exceptions are also built in, in the sense that primitive forms and procedures may raise exceptions. @@ -763,7 +763,7 @@ A @deftech{custodian} manages a collection of threads, @tech{file-stream ports}, TCP ports, @tech{TCP listeners}, @tech{UDP sockets}, and @tech{byte converters}. Whenever a thread, etc. is created, it is placed under the management of the @deftech{current -custodian} as determined by the @scheme[current-custodian] +custodian} as determined by the @racket[current-custodian] @tech{parameter}. @margin-note{In MrEd, custodians also manage eventspaces.} @@ -774,20 +774,20 @@ Every object managed by a subordinate custodian is also managed by the custodian's owner. When a @tech{custodian} is shut down via -@scheme[custodian-shutdown-all], it forcibly and immediately closes +@racket[custodian-shutdown-all], it forcibly and immediately closes the ports, TCP connections, etc. that it manages, as well as terminating (or suspending) its threads. A custodian that has been shut down cannot manage new objects. If the current custodian is shut down before a procedure is called to create a managed resource (e.g., -@scheme[open-input-port], @scheme[thread]), the +@racket[open-input-port], @racket[thread]), the @exnraise[exn:fail:contract]. A thread can have multiple managing custodians, and a suspended thread -created with @scheme[thread/suspend-to-kill] can have zero +created with @racket[thread/suspend-to-kill] can have zero custodians. Extra custodians become associated with a thread through -@scheme[thread-resume] (see @secref["threadkill"]). When a thread +@racket[thread-resume] (see @secref["threadkill"]). When a thread has multiple custodians, it is not necessarily killed by a -@scheme[custodian-shutdown-all], but shut-down custodians are removed +@racket[custodian-shutdown-all], but shut-down custodians are removed from the thread's managing set, and the thread is killed when its managing set becomes empty. @@ -800,15 +800,15 @@ collected, at which point its subordinates become immediately subordinate to the collected custodian's superordinate custodian. In addition to the other entities managed by a custodian, a -@deftech{custodian box} created with @scheme[make-custodian-box] +@deftech{custodian box} created with @racket[make-custodian-box] strongly holds onto a value placed in the box until the box's custodian is shut down. The custodian only weakly retains the box itself, however (so the box and its content can be collected if there are no other references to them). -When PLT Scheme is compiled with support for per-custodian memory -accounting (see @scheme[custodian-memory-accounting-available?]), the -@scheme[current-memory-use] procedure can report a custodian-specific +When Racket is compiled with support for per-custodian memory +accounting (see @racket[custodian-memory-accounting-available?]), the +@racket[current-memory-use] procedure can report a custodian-specific result. This result determines how much memory is occupied by objects that are reachable from the custodian's managed values, especially its threads, and including its sub-custodians' managed values. If an diff --git a/collects/scribblings/reference/prog-steps.ss b/collects/scribblings/reference/prog-steps.ss index abb60ee481..8b0dab6286 100644 --- a/collects/scribblings/reference/prog-steps.ss +++ b/collects/scribblings/reference/prog-steps.ss @@ -43,7 +43,7 @@ (define (*prog-steps cont? objs defs progs) (make-table - '((valignment top top top top top top)) + '((valignment baseline baseline baseline baseline baseline baseline)) (apply append (for/list ([obj (or objs (in-naturals))] diff --git a/collects/scribblings/reference/syntax-model.scrbl b/collects/scribblings/reference/syntax-model.scrbl index ed9f3a481d..2fd384d80d 100644 --- a/collects/scribblings/reference/syntax-model.scrbl +++ b/collects/scribblings/reference/syntax-model.scrbl @@ -3,13 +3,13 @@ (for-syntax mzscheme) "mz.ss") -@(define scheme-eval (make-base-eval)) -@(interaction-eval #:eval scheme-eval (require (for-syntax racket/base))) +@(define racket-eval (make-base-eval)) +@(interaction-eval #:eval racket-eval (require (for-syntax racket/base))) @;------------------------------------------------------------------------ @title[#:tag "syntax-model"]{Syntax Model} -The syntax of a Scheme program is defined by +The syntax of a Racket program is defined by @itemize[ @@ -22,7 +22,7 @@ The syntax of a Scheme program is defined by ] For details on the @tech{read} phase, see @secref["reader"]. Source -code is normally read in @scheme[read-syntax] mode, which produces a +code is normally read in @racket[read-syntax] mode, which produces a @tech{syntax object}. The @tech{expand} phase recursively processes a @tech{syntax object} @@ -38,7 +38,7 @@ new binding information. @guideintro["binding"]{binding} An @deftech{identifier} is source-program entity. Parsing (i.e., -expanding) a Scheme program reveals that some @tech{identifiers} +expanding) a Racket program reveals that some @tech{identifiers} correspond to @tech{variables}, some refer to syntactic forms, and some are quoted to produce a symbol or a syntax object. @@ -55,13 +55,13 @@ uses of an @tech{identifier} refer to the @tech{shadowing} For example, as a bit of source, the text -@schemeblock[(let ([x 5]) x)] +@racketblock[(let ([x 5]) x)] -includes two @tech{identifiers}: @scheme[let] and @scheme[x] (which +includes two @tech{identifiers}: @racket[let] and @racket[x] (which appears twice). When this source is parsed in a typical -@tech{environment}, @scheme[x] turns out to represent a -@tech{variable} (unlike @scheme[let]). In particular, the first -@scheme[x] @tech{binds} the second @scheme[x]. +@tech{environment}, @racket[x] turns out to represent a +@tech{variable} (unlike @racket[let]). In particular, the first +@racket[x] @tech{binds} the second @racket[x]. A @deftech{top-level binding} is a @tech{binding} from a definition at the top-level; a @deftech{module binding} is a binding from a @@ -73,10 +73,10 @@ identifiers are called @tech{unbound} in a module context. Throughout the documentation, @tech{identifiers} are typeset to suggest the way that they are parsed. A black, boldface -@tech{identifier} like @scheme[lambda] indicates as a reference to a -syntactic form. A plain blue @tech{identifier} like @schemeidfont{x} +@tech{identifier} like @racket[lambda] indicates as a reference to a +syntactic form. A plain blue @tech{identifier} like @racketidfont{x} is a @tech{variable} or a reference to an unspecified @tech{top-level -variable}. A hyperlinked @tech{identifier} @scheme[cons] is a +variable}. A hyperlinked @tech{identifier} @racket[cons] is a reference to a specific @tech{top-level variable}. Every binding has a @deftech{phase level} in which it can be @@ -108,17 +108,17 @@ different phase levels. @;------------------------------------------------------------------------ @section[#:tag "stxobj-model"]{Syntax Objects} -A @deftech{syntax object} combines a simpler Scheme value, such as a +A @deftech{syntax object} combines a simpler Racket value, such as a symbol or pair, with @deftech{lexical information} about bindings, source-location information, @tech{syntax properties}, and @tech{syntax certificates}. In particular, an @tech{identifier} is represented as a symbol object that combines a symbol and lexical and other information. -For example, a @schemeidfont{car} @tech{identifier} might have -@tech{lexical information} that designates it as the @scheme[car] from -the @schememodname[racket/base] language (i.e., the built-in -@scheme[car]). Similarly, a @schemeidfont{lambda} identifier's +For example, a @racketidfont{car} @tech{identifier} might have +@tech{lexical information} that designates it as the @racket[car] from +the @racketmodname[racket/base] language (i.e., the built-in +@racket[car]). Similarly, a @racketidfont{lambda} identifier's @tech{lexical information} may indicate that it represents a procedure form. Some other @tech{identifier}'s @tech{lexical information} may indicate that it references a @tech{top-level variable}. @@ -128,42 +128,42 @@ an @tech{identifier} or simple constant, its internal components can be extracted. Even for extracted identifier, detailed information about binding is available mostly indirectly; two identifiers can be compared to see if they refer to the same binding (i.e., -@scheme[free-identifier=?]), or whether each identifier would bind the +@racket[free-identifier=?]), or whether each identifier would bind the other if one was in a binding position and the other in an expression -position (i.e., @scheme[bound-identifier=?]). +position (i.e., @racket[bound-identifier=?]). For example, the when the program written as -@schemeblock[(let ([x 5]) (+ x 6))] +@racketblock[(let ([x 5]) (+ x 6))] is represented as a @tech{syntax object}, then two @tech{syntax -objects} can be extracted for the two @scheme[x]s. Both the -@scheme[free-identifier=?] and @scheme[bound-identifier=?] predicates -will indicate that the @scheme[x]s are the same. In contrast, the -@scheme[let] @tech{identifier} is not @scheme[free-identifier=?] or -@scheme[bound-identifier=?] to either @scheme[x]. +objects} can be extracted for the two @racket[x]s. Both the +@racket[free-identifier=?] and @racket[bound-identifier=?] predicates +will indicate that the @racket[x]s are the same. In contrast, the +@racket[let] @tech{identifier} is not @racket[free-identifier=?] or +@racket[bound-identifier=?] to either @racket[x]. The @tech{lexical information} in a @tech{syntax object} is independent of the other half, and it can be copied to a new syntax -object in combination with an arbitrary other Scheme value. Thus, +object in combination with an arbitrary other Racket value. Thus, identifier-@tech{binding} information in a @tech{syntax object} is predicated on the symbolic name of the @tech{identifier} as well as the identifier's @tech{lexical information}; the same question with the same @tech{lexical information} but different base value can produce a different answer. -For example, combining the lexical information from @scheme[let] in -the program above to @scheme['x] would not produce an identifier that -is @scheme[free-identifier=?] to either @scheme[x], since it does not -appear in the scope of the @scheme[x] binding. Combining the lexical -context of the @scheme[6] with @scheme['x], in contrast, would produce -an identifier that is @scheme[bound-identifier=?] to both @scheme[x]s. +For example, combining the lexical information from @racket[let] in +the program above to @racket['x] would not produce an identifier that +is @racket[free-identifier=?] to either @racket[x], since it does not +appear in the scope of the @racket[x] binding. Combining the lexical +context of the @racket[6] with @racket['x], in contrast, would produce +an identifier that is @racket[bound-identifier=?] to both @racket[x]s. -The @scheme[quote-syntax] form bridges the evaluation of a program and -the representation of a program. Specifically, @scheme[(quote-syntax +The @racket[quote-syntax] form bridges the evaluation of a program and +the representation of a program. Specifically, @racket[(quote-syntax _datum)] produces a syntax object that preserves all of the lexical -information that @scheme[_datum] had when it was parsed as part of the -@scheme[quote-syntax] form. +information that @racket[_datum] had when it was parsed as part of the +@racket[quote-syntax] form. @;------------------------------------------------------------------------ @section[#:tag "expansion"]{Expansion@aux-elem{ (Parsing)}} @@ -184,7 +184,7 @@ following grammar: @margin-note{Beware that the symbolic names of identifiers in a fully expanded program may not match the symbolic names in the grammar. Only -the binding (according to @scheme[free-identifier=?]) matters.} +the binding (according to @racket[free-identifier=?]) matters.} @schemegrammar*[ #:literals (#%expression module #%plain-module-begin begin #%provide @@ -217,7 +217,7 @@ the binding (according to @scheme[free-identifier=?]) matters.} (letrec-values (((id ...) expr) ...) expr ...+) (set! id expr) - (@#,scheme[quote] datum) + (@#,racket[quote] datum) (quote-syntax datum) (with-continuation-mark expr expr expr) (#%plain-app expr ...+) @@ -235,29 +235,29 @@ information} on its @tech{identifiers} indicates the @tech{parse}. More specifically, the typesetting of identifiers in the above grammar -is significant. For example, the second case for @scheme[_expr] is a +is significant. For example, the second case for @racket[_expr] is a @tech{syntax-object} list whose first element is an @tech{identifier}, where the @tech{identifier}'s @tech{lexical information} specifies a -binding to the @scheme[#%plain-lambda] of the -@schememodname[racket/base] language (i.e., the @tech{identifier} is -@scheme[free-identifier=?] to one whose binding is -@scheme[#%plain-lambda]). In all cases, identifiers above typeset as +binding to the @racket[#%plain-lambda] of the +@racketmodname[racket/base] language (i.e., the @tech{identifier} is +@racket[free-identifier=?] to one whose binding is +@racket[#%plain-lambda]). In all cases, identifiers above typeset as syntactic-form names refer to the bindings defined in @secref["syntax"]. Only @tech{phase levels} 0 and 1 are relevant for the parse of a -program (though the @scheme[_datum] in a @scheme[quote-syntax] form +program (though the @racket[_datum] in a @racket[quote-syntax] form preserves its information for all @tech{phase level}s). In particular, -the relevant @tech{phase level} is 0, except for the @scheme[_expr]s -in a @scheme[define-syntax], @scheme[define-syntaxes], -@scheme[define-for-syntax], or @scheme[define-values-for-syntax] form, +the relevant @tech{phase level} is 0, except for the @racket[_expr]s +in a @racket[define-syntax], @racket[define-syntaxes], +@racket[define-for-syntax], or @racket[define-values-for-syntax] form, in which case the relevant @tech{phase level} is 1 (for which -comparisons are made using @scheme[free-transformer-identifier=?] -instead of @scheme[free-identifier=?]). +comparisons are made using @racket[free-transformer-identifier=?] +instead of @racket[free-identifier=?]). -In addition to the grammar above, @scheme[letrec-syntaxes+values] can +In addition to the grammar above, @racket[letrec-syntaxes+values] can appear in a fully local-expanded expression, such as the result from -@scheme[local-expand] when the stop list is empty. +@racket[local-expand] when the stop list is empty. @;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @subsection[#:tag "expand-steps"]{Expansion Steps} @@ -274,15 +274,15 @@ the @tech{syntax object} being expanded: @tech{binding} other than as a @tech{top-level variable}, that @tech{binding} is used to continue. If the @tech{identifier} has no @tech{binding}, a new @tech{syntax-object} symbol - @scheme['#%top] is created using the @tech{lexical information} - of the @tech{identifier}; if this @schemeidfont{#%top} + @racket['#%top] is created using the @tech{lexical information} + of the @tech{identifier}; if this @racketidfont{#%top} @tech{identifier} has no @tech{binding} (other than as a @tech{top-level variable}), then parsing fails with an - @scheme[exn:fail:syntax] exception. Otherwise, the new + @racket[exn:fail:syntax] exception. Otherwise, the new @tech{identifier} is combined with the original @tech{identifier} in a new @tech{syntax-object} pair (also using the same @tech{lexical information} as the original - @tech{identifier}), and the @schemeidfont{#%top} @tech{binding} + @tech{identifier}), and the @racketidfont{#%top} @tech{binding} is used to continue.} @item{If it is a @tech{syntax-object} pair whose first element is an @@ -291,26 +291,26 @@ the @tech{syntax object} being expanded: the @tech{identifier}'s @tech{binding} is used to continue.} @item{If it is a @tech{syntax-object} pair of any other form, then a - new @tech{syntax-object} symbol @scheme['#%app] is created + new @tech{syntax-object} symbol @racket['#%app] is created using the @tech{lexical information} of the pair. If the - resulting @schemeidfont{#%app} @tech{identifier} has no - binding, parsing fails with an @scheme[exn:fail:syntax] + resulting @racketidfont{#%app} @tech{identifier} has no + binding, parsing fails with an @racket[exn:fail:syntax] exception. Otherwise, the new @tech{identifier} is combined with the original pair to form a new @tech{syntax-object} pair (also using the same @tech{lexical information} as the original - pair), and the @schemeidfont{#%app} @tech{binding} is used to + pair), and the @racketidfont{#%app} @tech{binding} is used to continue.} @item{If it is any other syntax object, then a new - @tech{syntax-object} symbol @scheme['#%datum] is created using + @tech{syntax-object} symbol @racket['#%datum] is created using the @tech{lexical information} of the original @tech{syntax - object}. If the resulting @schemeidfont{#%datum} + object}. If the resulting @racketidfont{#%datum} @tech{identifier} has no @tech{binding}, parsing fails with an - @scheme[exn:fail:syntax] exception. Otherwise, the new + @racket[exn:fail:syntax] exception. Otherwise, the new @tech{identifier} is combined with the original @tech{syntax object} in a new @tech{syntax-object} pair (using the same @tech{lexical information} as the original pair), and the - @schemeidfont{#%datum} @tech{binding} is used to continue.} + @racketidfont{#%datum} @tech{binding} is used to continue.} ] @@ -321,24 +321,24 @@ things: @itemize[ @item{A @tech{transformer binding}, such as introduced by - @scheme[define-syntax] or @scheme[let-syntax]. If the + @racket[define-syntax] or @racket[let-syntax]. If the associated value is a procedure of one argument, the procedure is called as a @tech{syntax transformer} (described below), and parsing starts again with the @tech{syntax-object} result. If the @tech{transformer binding} is to any other kind of value, - parsing fails with an @scheme[exn:fail:syntax] exception. The - call to the @tech{syntax transformer} is @scheme[parameterize]d - to set @scheme[current-namespace] to a @tech{namespace} that + parsing fails with an @racket[exn:fail:syntax] exception. The + call to the @tech{syntax transformer} is @racket[parameterize]d + to set @racket[current-namespace] to a @tech{namespace} that shares @tech{bindings} and @tech{variables} with the namespace being used to expand, except that its @tech{base phase} is one greater.} @item{A @tech{variable} @tech{binding}, such as introduced by a - module-level @scheme[define] or by @scheme[let]. In this case, + module-level @racket[define] or by @racket[let]. In this case, if the form being parsed is just an @tech{identifier}, then it is parsed as a reference to the corresponding @tech{variable}. If the form being parsed is a - @tech{syntax-object} pair, then an @scheme[#%app] is added to + @tech{syntax-object} pair, then an @racket[#%app] is added to the front of the @tech{syntax-object} pair in the same way as when the first item in the @tech{syntax-object} pair is not an identifier (third case in the previous enumeration), and @@ -357,7 +357,7 @@ things: Each expansion step occurs in a particular @deftech{context}, and transformers and core syntactic forms may expand differently for -different @tech{contexts}. For example, a @scheme[module] form is +different @tech{contexts}. For example, a @racket[module] form is allowed only in a @tech{top-level context}, and it fails in other contexts. The possible @tech{contexts} are as follows: @@ -365,7 +365,7 @@ contexts. The possible @tech{contexts} are as follows: @item{@deftech{top-level context} : outside of any module, definition, or expression, except that sub-expressions of a top-level - @scheme[begin] form are also expanded as top-level forms.} + @racket[begin] form are also expanded as top-level forms.} @item{@deftech{module-begin context} : inside the body of a module, as the only form within the module.} @@ -382,7 +382,7 @@ contexts. The possible @tech{contexts} are as follows: ] Different core @tech{syntactic forms} parse sub-forms using different -@tech{contexts}. For example, a @scheme[let] form always parses the +@tech{contexts}. For example, a @racket[let] form always parses the right-hand expressions of a binding in an @tech{expression context}, but it starts parsing the body in an @tech{internal-definition context}. @@ -395,58 +395,58 @@ core syntactic forms are encountered: @itemize[ - @item{When a @scheme[require] form is encountered at the top level or + @item{When a @racket[require] form is encountered at the top level or module level, all lexical information derived from the top level or the specific module's level are extended with bindings from the specified modules. If not otherwise indicated in the - @scheme[require] form, bindings are introduced at the + @racket[require] form, bindings are introduced at the @tech{phase level}s specified by the exporting modules: - @tech{phase level} 0 for each normal @scheme[provide], - @tech{phase level} 1 for each @scheme[for-syntax] - @scheme[provide], and so on. The @scheme[for-meta] - @scheme[provide] form allows exports at an arbitrary + @tech{phase level} 0 for each normal @racket[provide], + @tech{phase level} 1 for each @racket[for-syntax] + @racket[provide], and so on. The @racket[for-meta] + @racket[provide] form allows exports at an arbitrary @tech{phase level} (as long as a binding exists within the module at the @tech{phase level}). - A @scheme[for-syntax] sub-form within @scheme[require] imports + A @racket[for-syntax] sub-form within @racket[require] imports similarly, but the resulting bindings have a @tech{phase level} that is one more than the exported @tech{phase levels}, when exports for the @tech{label phase level} are still imported at the @tech{label phase level}. More generally, a - @scheme[for-meta] sub-form within @scheme[require] imports with + @racket[for-meta] sub-form within @racket[require] imports with the specified @tech{phase level} shift; if the specified shift - is @scheme[#f], or if @scheme[for-label] is used to import, + is @racket[#f], or if @racket[for-label] is used to import, then all bindings are imported into the @tech{label phase level}.} - @item{When a @scheme[define], @scheme[define-values], - @scheme[define-syntax], or @scheme[define-syntaxes] form is + @item{When a @racket[define], @racket[define-values], + @racket[define-syntax], or @racket[define-syntaxes] form is encountered at the top level or module level, all lexical information derived from the top level or the specific module's level is extended with bindings for the specified identifiers at @tech{phase level} 0 (i.e., the @tech{base environment} is extended).} - @item{When a @scheme[define-for-syntax] or - @scheme[define-values-for-syntax] form is encountered at the + @item{When a @racket[define-for-syntax] or + @racket[define-values-for-syntax] form is encountered at the top level or module level, bindings are introduced as for - @scheme[define-values], but at @tech{phase level} 1 (i.e., the + @racket[define-values], but at @tech{phase level} 1 (i.e., the @tech{transformer environment} is extended).} - @item{When a @scheme[let-values] form is encountered, the body of the - @scheme[let-values] form is extended (by creating new + @item{When a @racket[let-values] form is encountered, the body of the + @racket[let-values] form is extended (by creating new @tech{syntax objects}) with bindings for the specified identifiers. The same bindings are added to the identifiers themselves, so that the identifiers in binding position are - @scheme[bound-identifier=?] to uses in the fully expanded form, - and so they are not @scheme[bound-identifier=?] to other + @racket[bound-identifier=?] to uses in the fully expanded form, + and so they are not @racket[bound-identifier=?] to other identifiers. The bindings are available for use at the - @tech{phase level} at which the @scheme[let-values] form is + @tech{phase level} at which the @racket[let-values] form is expanded.} - @item{When a @scheme[letrec-values] or - @scheme[letrec-syntaxes+values] form is encountered, bindings - are added as for @scheme[let-values], except that the + @item{When a @racket[letrec-values] or + @racket[letrec-syntaxes+values] form is encountered, bindings + are added as for @racket[let-values], except that the right-hand-side expressions are also extended with the bindings.} @@ -457,26 +457,26 @@ core syntactic forms are encountered: A new binding in lexical information maps to a new variable. The identifiers mapped to this variable are those that currently have the -same binding (i.e., that are currently @scheme[bound-identifier=?]) to +same binding (i.e., that are currently @racket[bound-identifier=?]) to the identifier associated with the binding. For example, in -@schemeblock[ +@racketblock[ (let-values ([(x) 10]) (+ x y)) ] -the binding introduced for @scheme[x] applies to the @scheme[x] in the -body, but not the @scheme[y] n the body, because (at the point in -expansion where the @scheme[let-values] form is encountered) the -binding @scheme[x] and the body @scheme[y] are not -@scheme[bound-identifier=?]. +the binding introduced for @racket[x] applies to the @racket[x] in the +body, but not the @racket[y] n the body, because (at the point in +expansion where the @racket[let-values] form is encountered) the +binding @racket[x] and the body @racket[y] are not +@racket[bound-identifier=?]. @;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @subsection[#:tag "transformer-model"]{Transformer Bindings} In a @tech{top-level context} or @tech{module context}, when the -expander encounters a @scheme[define-syntaxes] form, the binding that +expander encounters a @racket[define-syntaxes] form, the binding that it introduces for the defined identifiers is a @deftech{transformer binding}. The @tech{value} of the @tech{binding} exists at expansion time, rather than run time (though the two times can overlap), though @@ -484,13 +484,13 @@ the binding itself is introduced with @tech{phase level} 0 (i.e., in the @tech{base environment}). The @tech{value} for the binding is obtained by evaluating the -expression in the @scheme[define-syntaxes] form. This expression must +expression in the @racket[define-syntaxes] form. This expression must be @tech{expand}ed (i.e. parsed) before it can be evaluated, and it is expanded at @tech{phase level} 1 (i.e., in the @tech{transformer environment}) instead of @tech{phase level} 0. -If the resulting @scheme[value] is a procedure of one argument or -the result of @scheme[make-set!-transformer] on a procedure, then it +If the resulting @racket[value] is a procedure of one argument or +the result of @racket[make-set!-transformer] on a procedure, then it is used as a @deftech{syntax transformer} (a.k.a. @deftech{macro}). The procedure is expected to accept a syntax object and return a syntax object. A use of the binding (at @tech{phase level} 0) triggers @@ -503,7 +503,7 @@ applies to all sub-@tech{syntax objects}). The result of the transformer is similarly extended with the same @tech{syntax mark}. When a @tech{syntax object}'s @tech{lexical information} includes the same mark twice in a row, the marks effectively -cancel. Otherwise, two identifiers are @scheme[bound-identifier=?] +cancel. Otherwise, two identifiers are @racket[bound-identifier=?] (that is, one can bind the other) only if they have the same binding and if they have the same marks---counting only marks that were added after the binding. @@ -512,7 +512,7 @@ This marking process helps keep binding in an expanded program consistent with the lexical structure of the source program. For example, the expanded form of the program -@schemeblock[ +@racketblock[ (define x 12) (define-syntax m (syntax-rules () @@ -522,7 +522,7 @@ example, the expanded form of the program is -@schemeblock[ +@racketblock[ (define x 12) (define-syntax m (syntax-rules () @@ -530,42 +530,42 @@ is (let-values ([(x) 10]) x) ] -However, the result of the last expression is @scheme[12], not -@scheme[10]. The reason is that the transformer bound to @scheme[m] -introduces the binding @scheme[x], but the referencing @scheme[x] is -present in the argument to the transformer. The introduced @scheme[x] -is the one left with a mark, and the reference @scheme[x] has no mark, -so the binding @scheme[x] is not @scheme[bound-identifier=?] to the -body @scheme[x]. +However, the result of the last expression is @racket[12], not +@racket[10]. The reason is that the transformer bound to @racket[m] +introduces the binding @racket[x], but the referencing @racket[x] is +present in the argument to the transformer. The introduced @racket[x] +is the one left with a mark, and the reference @racket[x] has no mark, +so the binding @racket[x] is not @racket[bound-identifier=?] to the +body @racket[x]. -The @scheme[set!] form works with the @scheme[make-set!-transformer] -and @scheme[prop:set!-transformer] property to support -@deftech{assignment transformers} that transform @scheme[set!] +The @racket[set!] form works with the @racket[make-set!-transformer] +and @racket[prop:set!-transformer] property to support +@deftech{assignment transformers} that transform @racket[set!] expressions. An @tech{assignment transformer} contains a procedure -that is applied by @scheme[set!] in the same way as a normal +that is applied by @racket[set!] in the same way as a normal transformer by the expander. -The @scheme[make-rename-transformer] procedure or -@scheme[prop:rename-transformer] property creates a value that is also -handled specially by the expander and by @scheme[set!] as a -transformer binding's value. When @scheme[_id] is bound to a +The @racket[make-rename-transformer] procedure or +@racket[prop:rename-transformer] property creates a value that is also +handled specially by the expander and by @racket[set!] as a +transformer binding's value. When @racket[_id] is bound to a @deftech{rename transformer} produced by -@scheme[make-rename-transformer], it is replaced with the target -identifier passed to @scheme[make-rename-transformer]. In addition, as +@racket[make-rename-transformer], it is replaced with the target +identifier passed to @racket[make-rename-transformer]. In addition, as long as the target identifier does not have a true value for the -@scheme['not-free-identifier=?] @tech{syntax property}, the lexical information that -contains the binding of @scheme[_id] is also enriched so that -@scheme[_id] is @scheme[free-identifier=?] to the target identifier, -@scheme[identifier-binding] returns the same results for both -identifiers, and @scheme[provide] exports @scheme[_id] as the target +@racket['not-free-identifier=?] @tech{syntax property}, the lexical information that +contains the binding of @racket[_id] is also enriched so that +@racket[_id] is @racket[free-identifier=?] to the target identifier, +@racket[identifier-binding] returns the same results for both +identifiers, and @racket[provide] exports @racket[_id] as the target identifier. Finally, the binding is treated specially by -@scheme[syntax-local-value], and -@scheme[syntax-local-make-delta-introducer] as used by @tech{syntax +@racket[syntax-local-value], and +@racket[syntax-local-make-delta-introducer] as used by @tech{syntax transformer}s. In addition to using marks to track introduced identifiers, the expander tracks the expansion history of a form through @tech{syntax -properties} such as @scheme['origin]. See @secref["stxprops"] for +properties} such as @racket['origin]. See @secref["stxprops"] for more information. Finally, the expander uses @tech{syntax certificates} to control the @@ -573,15 +573,15 @@ way that unexported and protected @tech{module bindings} are used. See @secref["stxcerts"] for more information on @tech{syntax certificates}. -The expander's handling of @scheme[letrec-values+syntaxes] is similar -to its handling of @scheme[define-syntaxes]. A -@scheme[letrec-values+syntaxes] mist be expanded in an arbitrary phase +The expander's handling of @racket[letrec-values+syntaxes] is similar +to its handling of @racket[define-syntaxes]. A +@racket[letrec-values+syntaxes] mist be expanded in an arbitrary phase level @math{n} (not just 0), in which case the expression for the @tech{transformer binding} is expanded at @tech{phase level} @math{n+1}. -The expression in a @scheme[define-for-syntax] or -@scheme[define-values-for-syntax] form is expanded and evaluated in -the same way as for @scheme[syntax]. However, the introduced binding +The expression in a @racket[define-for-syntax] or +@racket[define-values-for-syntax] form is expanded and evaluated in +the same way as for @racket[syntax]. However, the introduced binding is a variable binding at @tech{phase level} 1 (not a @tech{transformer binding} at @tech{phase level} 0). @@ -595,9 +595,9 @@ forms. Partial expansion works by cutting off the normal recursion expansion when the relevant binding is for a primitive syntactic form. As a special case, when expansion would otherwise add an -@schemeidfont{#%app}, @schemeidfont{#%datum}, or @schemeidfont{#%top} +@racketidfont{#%app}, @racketidfont{#%datum}, or @racketidfont{#%top} identifier to an expression, and when the binding turns out to be the -primitive @scheme[#%app], @scheme[#%datum], or @scheme[#%top] form, +primitive @racket[#%app], @racket[#%datum], or @racket[#%top] form, then expansion stops without adding the identifier. @;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -611,72 +611,72 @@ recursively expands only until the form becomes one of the following: @itemize[ - @item{A @scheme[define-values] or @scheme[define-syntaxes] form, for + @item{A @racket[define-values] or @racket[define-syntaxes] form, for any form other than the last one: The definition form is not expanded further. Instead, the next form is expanded partially, and so on. As soon as an expression form is found, the accumulated definition forms are converted to a - @scheme[letrec-values] (if no @scheme[define-syntaxes] forms - were found) or @scheme[letrec-syntaxes+values] form, moving the + @racket[letrec-values] (if no @racket[define-syntaxes] forms + were found) or @racket[letrec-syntaxes+values] form, moving the expression forms to the body to be expanded in expression context. - When a @scheme[define-values] form is discovered, the lexical + When a @racket[define-values] form is discovered, the lexical context of all syntax objects for the body sequence is immediately enriched with bindings for the - @scheme[define-values] form before expansion continues. When a - @scheme[define-syntaxes] form is discovered, the right-hand + @racket[define-values] form before expansion continues. When a + @racket[define-syntaxes] form is discovered, the right-hand side is expanded and evaluated (as for a - @scheme[letrec-values+syntaxes] form), and a transformer + @racket[letrec-values+syntaxes] form), and a transformer binding is installed for the body sequence before expansion continues.} - @item{A primitive expression form other than @scheme[begin]: The + @item{A primitive expression form other than @racket[begin]: The expression is expanded in an expression context, along with all remaining body forms. If any definitions were found, this expansion takes place after conversion to a - @scheme[letrec-values] or @scheme[letrec-syntaxes+values] + @racket[letrec-values] or @racket[letrec-syntaxes+values] form. Otherwise, the expressions are expanded immediately.} - @item{A @scheme[begin] form: The sub-forms of the @scheme[begin] are + @item{A @racket[begin] form: The sub-forms of the @racket[begin] are spliced into the internal-definition sequence, and partial expansion continues with the first of the newly-spliced forms - (or the next form, if the @scheme[begin] had no sub-forms).} + (or the next form, if the @racket[begin] had no sub-forms).} ] -If the last expression form turns out to be a @scheme[define-values] -or @scheme[define-syntaxes] form, expansion fails with a syntax error. +If the last expression form turns out to be a @racket[define-values] +or @racket[define-syntaxes] form, expansion fails with a syntax error. @;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @subsection[#:tag "mod-parse"]{Module Phases and Visits} -A @scheme[require] form not only introduces @tech{bindings} at +A @racket[require] form not only introduces @tech{bindings} at expansion time, but also @deftech{visits} the referenced module when it is encountered by the expander. That is, the expander -instantiates any @scheme[define-for-syntax]ed variables defined +instantiates any @racket[define-for-syntax]ed variables defined in the module, and also evaluates all expressions for -@scheme[define-syntaxes] @tech{transformer bindings}. +@racket[define-syntaxes] @tech{transformer bindings}. -Module @tech{visits} propagate through @scheme[require]s in the same +Module @tech{visits} propagate through @racket[require]s in the same way as module @tech{instantiation}. Moreover, when a module is -@tech{visit}ed at @tech{phase} 0, any module that it @scheme[require]s -@scheme[for-syntax] is @tech{instantiate}d at @tech{phase} 1, while -further @scheme[require]s @scheme[for-template] leading back +@tech{visit}ed at @tech{phase} 0, any module that it @racket[require]s +@racket[for-syntax] is @tech{instantiate}d at @tech{phase} 1, while +further @racket[require]s @racket[for-template] leading back to @tech{phase} 0 causes the required module to be visited at @tech{phase} 0 (i.e., not @tech{instantiate}d). During compilation, the top-level of module context is itself implicitly @tech{visit}ed. Thus, when the expander encounters -@scheme[(require (for-syntax ....))], it immediately +@racket[(require (for-syntax ....))], it immediately @tech{instantiate}s the required module at @tech{phase} 1, in addition to adding bindings at @tech{phase level} 1 (i.e., the @tech{transformer environment}). Similarly, the expander immediately -evaluates any @scheme[define-values-for-syntax] form that it +evaluates any @racket[define-values-for-syntax] form that it encounters. @tech{Phases} beyond 0 are @tech{visit}ed on demand. For example, -when the right-hand side of a @tech{phase}-0 @scheme[let-syntax] is to +when the right-hand side of a @tech{phase}-0 @racket[let-syntax] is to be expanded, then modules that are @tech{available} at @tech{phase} 1 are visited. More generally, initiating expansion at @tech{phase} @math{n} @tech{visit}s modules at @tech{phase} @math{n}, which in turn @@ -686,14 +686,14 @@ modules in the enclosing @tech{namespace}'s @tech{module registry}; a per-registry lock prevents multiple threads from concurrently instantiating and visiting available modules. -When the expander encounters @scheme[require] and @scheme[(require +When the expander encounters @racket[require] and @racket[(require (for-syntax ....))] within a @tech{module context}, the resulting @tech{visits} and @tech{instantiations} are specific to the expansion of the enclosing module, and are kept separate from @tech{visits} and @tech{instantiations} triggered from a @tech{top-level context} or from the expansion of a different module. Along the same lines, when a module is attached to a namespace through -@scheme[namespace-attach-module], modules that it @scheme[require]s +@racket[namespace-attach-module], modules that it @racket[require]s are transitively attached, but instances are attached only at phases at or below the namespace's @tech{base phase}. @@ -710,7 +710,7 @@ When a top-level definition binds an identifier that originates from a (define-syntax def-and-use-of-x (syntax-rules () [(def-and-use-of-x val) - (code:comment @#,t{@scheme[x] below originates from this macro:}) + (code:comment @#,t{@racket[x] below originates from this macro:}) (begin (define x val) x)])) (define x 1) x @@ -720,7 +720,7 @@ x (define-syntax def-and-use (syntax-rules () [(def-and-use x val) - (code:comment @#,t{@scheme{x} below was provided by the macro use:}) + (code:comment @#,t{@racket{x} below was provided by the macro use:}) (begin (define x val) x)])) (def-and-use x 3) x @@ -733,12 +733,12 @@ For a top-level definition (outside of a module), the order of definition were not present. (No such dependency on order occurs within a module, since a module binding covers the entire module body.) To support the declaration of an identifier before its use, - the @scheme[define-syntaxes] form avoids binding an identifier if the - body of the @scheme[define-syntaxes] declaration produces zero + the @racket[define-syntaxes] form avoids binding an identifier if the + body of the @racket[define-syntaxes] declaration produces zero results. @examples[ -#:eval scheme-eval +#:eval racket-eval (define bucket-1 0) (define bucket-2 0) (define-syntax def-and-set!-use-of-x @@ -755,7 +755,7 @@ bucket-2 (syntax-rules () [(def-and-use) (begin - (code:comment @#,t{Initial reference to @scheme[even] precedes definition:}) + (code:comment @#,t{Initial reference to @racket[even] precedes definition:}) (define (odd x) (if (zero? x) #f (even (sub1 x)))) (define (even x) (if (zero? x) #t (odd (sub1 x)))) (odd 17))])) @@ -765,7 +765,7 @@ bucket-2 (syntax-rules () [(def-and-use) (begin - (code:comment @#,t{Declare before definition via no-values @scheme[define-syntaxes]:}) + (code:comment @#,t{Declare before definition via no-values @racket[define-syntaxes]:}) (define-syntaxes (odd even) (values)) (define (odd x) (if (zero? x) #f (even (sub1 x)))) (define (even x) (if (zero? x) #t (odd (sub1 x)))) @@ -773,29 +773,29 @@ bucket-2 (defs-and-uses) ] -Macro-generated @scheme{require} and @scheme{provide} +Macro-generated @racket{require} and @racket{provide} clauses also introduce and reference generation-specific bindings: @itemize[ - @item{In @scheme[require], for a @scheme[_require-spec] of the form - @scheme[(rename-in [_orig-id _bind-id])] or @scheme[(only-in - .... [_orig-id _bind-id])], the @scheme[_bind-id] is bound only for + @item{In @racket[require], for a @racket[_require-spec] of the form + @racket[(rename-in [_orig-id _bind-id])] or @racket[(only-in + .... [_orig-id _bind-id])], the @racket[_bind-id] is bound only for uses of the identifier generated by the same macro expansion as - @scheme[_bind-id]. In @scheme[require] for other - @scheme[_require-spec]s, the generator of the @scheme[_require-spec] + @racket[_bind-id]. In @racket[require] for other + @racket[_require-spec]s, the generator of the @racket[_require-spec] determines the scope of the bindings.} - @item{In @scheme[provide], for a @scheme[_provide-spec] of the form - @scheme[_id], the exported identifier is the one that binds - @scheme[_id] within the module in a generator-specific way, but the - external name is the plain @scheme[_id]. The exceptions for - @scheme[all-except-out] are similarly determined in a - generator-specific way, as is the @scheme[_orig-id] binding of a - @scheme[rename-out] form, but plain identifiers are used for the - external names. For @scheme[all-defined-out], only identifiers with + @item{In @racket[provide], for a @racket[_provide-spec] of the form + @racket[_id], the exported identifier is the one that binds + @racket[_id] within the module in a generator-specific way, but the + external name is the plain @racket[_id]. The exceptions for + @racket[all-except-out] are similarly determined in a + generator-specific way, as is the @racket[_orig-id] binding of a + @racket[rename-out] form, but plain identifiers are used for the + external names. For @racket[all-defined-out], only identifiers with definitions having the same generator as the - @scheme[(all-defined-out)] form are exported; the external name is + @racket[(all-defined-out)] form are exported; the external name is the plain identifier from the definition.} ] @@ -815,7 +815,7 @@ string, so it is suitable for saving and re-loading code. Although individual read, expand, compile, and evaluate operations are available, the operations are often combined automatically. For -example, the @scheme[eval] procedure takes a syntax object and expands +example, the @racket[eval] procedure takes a syntax object and expands it, compiles it, and evaluates it. @;------------------------------------------------------------------------ @@ -826,7 +826,7 @@ manipulate namespaces.} A @deftech{namespace} is a top-level mapping from symbols to binding information. It is the starting point for expanding an expression; a -@tech{syntax object} produced by @scheme[read-syntax] has no initial +@tech{syntax object} produced by @racket[read-syntax] has no initial lexical context; the @tech{syntax object} can be expanded after initializing it with the mappings of a particular namespace. A namespace is also the starting point evaluating expanded code, where @@ -850,7 +850,7 @@ An ``empty'' namespace maps all symbols to top-level variables. Certain evaluations extend a namespace for future expansions; importing a module into the top-level adjusts the namespace bindings for all of the imported named, and evaluating a top-level -@scheme[define] form updates the namespace's mapping to refer to a +@racket[define] form updates the namespace's mapping to refer to a variable (in addition to installing a value into the variable). A namespace also has a @deftech{module registry} that maps module @@ -863,9 +863,9 @@ distinct set of module instances in each @tech{phase}. That is, even though module declarations are shared for all @tech{phase levels}, module instances are distinct for each @tech{phase}. Each namespace has a @deftech{base phase}, which corresponds to the phase used by -reflective operations such as @scheme[eval] and -@scheme[dynamic-require]. In particular, using @scheme[eval] on a -@scheme[require] form @tech{instantiates} a module in the namespace's +reflective operations such as @racket[eval] and +@racket[dynamic-require]. In particular, using @racket[eval] on a +@racket[require] form @tech{instantiates} a module in the namespace's @tech{base phase}. After a namespace is created, module instances from existing @@ -890,14 +890,14 @@ 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].}) +(code:comment @#,t{The following @racket[let] expression is compiled in the original}) +(code:comment @#,t{namespace, so direct references to @racket[x] see @racket['orig].}) (code:line (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]})) + (display x) (code:comment @#,t{displays @racket['orig]}) + (display (eval 'x)))) (code:comment @#,t{displays @racket['new]})) ] A @tech{namespace} is purely a top-level entity, not to be confused @@ -924,7 +924,7 @@ x (define x 7) x (f) -(module m mzscheme (define x 8) (provide x)) +(module m racket (define x 8) (provide x)) (require 'm) (eval:alts x (eval 'x)) (f) @@ -937,28 +937,28 @@ To improve error reporting, names are inferred at compile-time for certain kinds of values, such as procedures. For example, evaluating the following expression: -@schemeblock[ +@racketblock[ (let ([f (lambda () 0)]) (f 1 2 3)) ] produces an error message because too many arguments are provided to -the procedure. The error message is able to report @schemeidfont{f} as -the name of the procedure. In this case, Scheme decides, at -compile-time, to name as @scheme['f] all procedures created by the -@scheme[let]-bound @scheme[lambda]. +the procedure. The error message is able to report @racketidfont{f} as +the name of the procedure. In this case, Racket decides, at +compile-time, to name as @racket['f] all procedures created by the +@racket[let]-bound @racket[lambda]. Names are inferred whenever possible for procedures. Names closer to an expression take precedence. For example, in -@schemeblock[ +@racketblock[ (define my-f (let ([f (lambda () 0)]) f)) ] -the procedure bound to @scheme[my-f] will have the inferred name -@scheme['f]. +the procedure bound to @racket[my-f] will have the inferred name +@racket['f]. -When an @indexed-scheme['inferred-name] property is attached to a +When an @indexed-racket['inferred-name] property is attached to a syntax object for an expression (see @secref["stxprops"]), the property value is used for naming the expression, and it overrides any name that was inferred from the expression's context. Normally, the @@ -967,8 +967,8 @@ property value should be a symbol or an identifier. When an inferred name is not available, but a source location is available, a name is constructed using the source location information. Inferred and property-assigned names are also available -to syntax transformers, via @scheme[syntax-local-name]. +to syntax transformers, via @racket[syntax-local-name]. @;---------------------------------------- -@close-eval[scheme-eval] +@close-eval[racket-eval] diff --git a/collects/scribblings/reference/syntax.scrbl b/collects/scribblings/reference/syntax.scrbl index a9b7326484..436b071eb1 100644 --- a/collects/scribblings/reference/syntax.scrbl +++ b/collects/scribblings/reference/syntax.scrbl @@ -22,9 +22,9 @@ the-eval))) @(define meta-in-eval (syntax-eval)) -@(define cvt (schemefont "CVT")) -@(define unquote-id (scheme unquote)) -@(define unquote-splicing-id (scheme unquote-splicing)) +@(define cvt (racketfont "CVT")) +@(define unquote-id (racket unquote)) +@(define unquote-splicing-id (racket unquote-splicing)) @title[#:tag "syntax" #:style 'toc]{Syntactic Forms} @@ -39,20 +39,20 @@ See @secref["fully-expanded"] for the core grammar. Each syntactic form is described by a BNF-like notation that describes a combination of (syntax-wrapped) pairs, symbols, and other data (not a sequence of characters). These grammatical specifications are shown -as in the following specification of a @schemekeywordfont{something} +as in the following specification of a @racketkeywordfont{something} form: -@specsubform[(@#,schemekeywordfont{something} id thing-expr ...) +@specsubform[(@#,racketkeywordfont{something} id thing-expr ...) #:contracts ([thing-expr number?])] Within such specifications, @itemize[ - @item{@scheme[...] indicates zero or more + @item{@racket[...] indicates zero or more repetitions of the preceding datum.} - @item{@scheme[...+] indicates one or + @item{@racket[...+] indicates one or more repetitions of the preceding datum.} @item{Italic meta-identifiers play the role of non-terminals. Some @@ -60,17 +60,17 @@ Within such specifications, @itemize[ - @item{A meta-identifier that ends in @scheme[_id] stands for an + @item{A meta-identifier that ends in @racket[_id] stands for an identifier.} - @item{A meta-identifier that ends in @scheme[_keyword] stands + @item{A meta-identifier that ends in @racket[_keyword] stands for a keyword.} - @item{A meta-identifier that ends with @scheme[_expr] (such as - @scheme[_thing-expr]) stands for a sub-form that is + @item{A meta-identifier that ends with @racket[_expr] (such as + @racket[_thing-expr]) stands for a sub-form that is expanded as an expression.} - @item{A meta-identifier that ends with @scheme[_body] stands + @item{A meta-identifier that ends with @racket[_body] stands for a sub-form that is expanded in an internal-definition context (see @secref["intdef-body"]).} @@ -78,75 +78,75 @@ Within such specifications, ]} @item{Contracts indicate constraints on sub-expression results. For - example, @scheme[_thing-expr @#,elem{:} number?] indicates that - the expression @scheme[_thing-expr] must produce a number.}] + example, @racket[_thing-expr @#,elem{:} number?] indicates that + the expression @racket[_thing-expr] must produce a number.}] @;------------------------------------------------------------------------ -@section[#:tag "module"]{Modules: @scheme[module], ...} +@section[#:tag "module"]{Modules: @racket[module], ...} -@guideintro["module-syntax"]{@scheme[module]} +@guideintro["module-syntax"]{@racket[module]} @defform[(module id module-path form ...)]{ Declares a top-level module. If the -@scheme[current-module-declare-name] parameter is set, the parameter -value is used for the module name, otherwise @scheme[(#,(scheme quote) +@racket[current-module-declare-name] parameter is set, the parameter +value is used for the module name, otherwise @racket[(#,(racket quote) id)] is the name of the declared module. -@margin-note/ref{For a @scheme[module]-like form for use @emph{within} -modules and other contexts, see @scheme[define-package].} +@margin-note/ref{For a @racket[module]-like form for use @emph{within} +modules and other contexts, see @racket[define-package].} -The @scheme[module-path] form must be as for @scheme[require], and it -supplies the initial bindings for the body @scheme[form]s. That is, it -is treated like a @scheme[(require module-path)] prefix before the -@scheme[form]s, except that the bindings introduced by -@scheme[module-path] can be shadowed by definitions and -@scheme[require]s in the module body @scheme[form]s. +The @racket[module-path] form must be as for @racket[require], and it +supplies the initial bindings for the body @racket[form]s. That is, it +is treated like a @racket[(require module-path)] prefix before the +@racket[form]s, except that the bindings introduced by +@racket[module-path] can be shadowed by definitions and +@racket[require]s in the module body @racket[form]s. -If a single @scheme[form] is provided, then it is partially expanded +If a single @racket[form] is provided, then it is partially expanded in a @tech{module-begin context}. If the expansion leads to -@scheme[#%plain-module-begin], then the body of the -@scheme[#%plain-module-begin] is the body of the module. If partial +@racket[#%plain-module-begin], then the body of the +@racket[#%plain-module-begin] is the body of the module. If partial expansion leads to any other primitive form, then the form is wrapped -with @schemeidfont{#%module-begin} using the lexical context of the +with @racketidfont{#%module-begin} using the lexical context of the module body; this identifier must be bound by the initial -@scheme[module-path] import, and its expansion must produce a -@scheme[#%plain-module-begin] to supply the module body. Finally, if -multiple @scheme[form]s are provided, they are wrapped with -@schemeidfont{#%module-begin}, as in the case where a single -@scheme[form] does not expand to @scheme[#%plain-module-begin]. +@racket[module-path] import, and its expansion must produce a +@racket[#%plain-module-begin] to supply the module body. Finally, if +multiple @racket[form]s are provided, they are wrapped with +@racketidfont{#%module-begin}, as in the case where a single +@racket[form] does not expand to @racket[#%plain-module-begin]. After such wrapping, if any, and before any expansion, an -@indexed-scheme['enclosing-module-name] property is attached to the -@schemeidfont{#%module-begin} syntax object (see +@indexed-racket['enclosing-module-name] property is attached to the +@racketidfont{#%module-begin} syntax object (see @secref["stxprops"]); the property's value is a symbol -corresponding to @scheme[id]. +corresponding to @racket[id]. -Each @scheme[form] is partially expanded (see +Each @racket[form] is partially expanded (see @secref["partial-expansion"]) in a @tech{module context}. Further action depends on the shape of the form: @itemize[ - @item{If it is a @scheme[begin] form, the sub-forms are flattened + @item{If it is a @racket[begin] form, the sub-forms are flattened out into the module's body and immediately processed in place of the - @scheme[begin].} + @racket[begin].} - @item{If it is a @scheme[define-syntaxes] or - @scheme[define-values-for-syntax] form, then the right-hand side is + @item{If it is a @racket[define-syntaxes] or + @racket[define-values-for-syntax] form, then the right-hand side is evaluated (in @tech{phase} 1), and the binding is immediately installed for further partial expansion within the - module. Evaluation of the right-hand side is @scheme[parameterize]d - to set @scheme[current-namespace] as in @scheme[let-syntax].} + module. Evaluation of the right-hand side is @racket[parameterize]d + to set @racket[current-namespace] as in @racket[let-syntax].} - @item{If the form is a @scheme[require] form, bindings are introduced + @item{If the form is a @racket[require] form, bindings are introduced immediately, and the imported modules are @tech{instantiate}d or @tech{visit}ed as appropriate.} - @item{If the form is a @scheme[provide] form, then it is recorded for + @item{If the form is a @racket[provide] form, then it is recorded for processing after the rest of the body.} - @item{If the form is a @scheme[define-values] form, then the binding + @item{If the form is a @racket[define-values] form, then the binding is installed immediately, but the right-hand expression is not expanded further.} @@ -155,55 +155,55 @@ action depends on the shape of the form: ] -After all @scheme[form]s have been partially expanded this way, then +After all @racket[form]s have been partially expanded this way, then the remaining expression forms (including those on the right-hand side of a definition) are expanded in an expression context. The scope of all imported identifiers covers the entire module body, as does the scope of any identifier defined within the module body. The ordering of syntax definitions does not affect the scope of the -syntax names; a transformer for @scheme[A] can produce expressions -containing @scheme[B], while the transformer for @scheme[B] produces -expressions containing @scheme[A], regardless of the order of -declarations for @scheme[A] and @scheme[B]. However, a syntactic form +syntax names; a transformer for @racket[A] can produce expressions +containing @racket[B], while the transformer for @racket[B] produces +expressions containing @racket[A], regardless of the order of +declarations for @racket[A] and @racket[B]. However, a syntactic form that produces syntax definitions must be defined before it is used. No identifier can be imported or defined more than once at any @tech{phase level}. Every exported identifier must be imported or defined. No expression can refer to a @tech{top-level variable}. -The evaluation of a @scheme[module] form does not evaluate the +The evaluation of a @racket[module] form does not evaluate the expressions in the body of the module. Evaluation merely declares a -module, whose full name depends both on @scheme[id] and -@scheme[(current-module-declare-name)]. +module, whose full name depends both on @racket[id] and +@racket[(current-module-declare-name)]. The module body is executed only when the module is explicitly -@techlink{instantiate}d via @scheme[require] or -@scheme[dynamic-require]. On invocation, expressions and definitions +@techlink{instantiate}d via @racket[require] or +@racket[dynamic-require]. On invocation, expressions and definitions are evaluated in order as they appear within the module. Each evaluation of an expression or definition is wrapped with a -continuation prompt (see @scheme[call-with-continuation-prompt]) for +continuation prompt (see @racket[call-with-continuation-prompt]) for the default continuation and using the default prompt handler. Accessing a @tech{module-level variable} before it is defined signals a run-time error, just like accessing an undefined global variable. If a module (in its fully expanded form) does not contain a -@scheme[set!] for an identifier that defined within the module, then +@racket[set!] for an identifier that defined within the module, then the identifier is a @defterm{constant} after it is defined; its value cannot be changed afterward, not even through reflective -mechanisms. The @scheme[compile-enforce-module-constants] parameter, +mechanisms. The @racket[compile-enforce-module-constants] parameter, however, can be used to disable enforcement of constants. -When a @tech{syntax object} representing a @scheme[module] form has a -@indexed-scheme['module-language] @tech{syntax property} attached, and +When a @tech{syntax object} representing a @racket[module] form has a +@indexed-racket['module-language] @tech{syntax property} attached, and when the property value is a vector of three elements where the first -is a module path (in the sense of @scheme[module-path?]) and the +is a module path (in the sense of @racket[module-path?]) and the second is a symbol, then the property value is preserved in the corresponding compiled and/or declared module. The third component of -the vector should be printable and @scheme[read]able, so that it can +the vector should be printable and @racket[read]able, so that it can be preserved in marshaled bytecode. See also -@scheme[module-compiled-language-info] and -@scheme[module->language-info].} +@racket[module-compiled-language-info] and +@racket[module->language-info].} See also @secref["module-eval-model"] and @secref["mod-parse"]. @@ -220,24 +220,24 @@ See also @secref["module-eval-model"] and @secref["mod-parse"]. @defform[(#%module-begin form ...)]{ Legal only in a @tech{module begin context}, and handled by the -@scheme[module] form. +@racket[module] form. -The @scheme[#%module-begin] form of @schememodname[racket/base] wraps +The @racket[#%module-begin] form of @racketmodname[racket/base] wraps every top-level expression to print non-@|void-const| results using -@scheme[current-print].} +@racket[current-print].} @defform[(#%plain-module-begin form ...)]{ Legal only in a @tech{module begin context}, and handled by the -@scheme[module] form.} +@racket[module] form.} @;------------------------------------------------------------------------ -@section[#:tag '("require" "provide")]{Importing and Exporting: @scheme[require] and @scheme[provide]} +@section[#:tag '("require" "provide")]{Importing and Exporting: @racket[require] and @racket[provide]} @section-index["modules" "imports"] @section-index["modules" "exports"] -@guideintro["module-require"]{@scheme[require]} +@guideintro["module-require"]{@racket[require]} @defform/subs[#:literals (only-in prefix-in except-in rename-in lib file planet + - = for-syntax for-template for-label for-meta only-meta-in combine-in quote) @@ -254,7 +254,7 @@ Legal only in a @tech{module begin context}, and handled by the (for-label require-spec ...) (for-meta phase-level require-spec ...) derived-require-spec] - [module-path (#,(scheme quote) id) + [module-path (#,(racket quote) id) rel-string (lib rel-string ...+) id @@ -272,60 +272,60 @@ Legal only in a @tech{module begin context}, and handled by the (code:line nat minor-vers)] [minor-vers nat (nat nat) - ((unsyntax (schemeidfont "=")) nat) - ((unsyntax (schemeidfont "+")) nat) - ((unsyntax (schemeidfont "-")) nat)])]{ + ((unsyntax (racketidfont "=")) nat) + ((unsyntax (racketidfont "+")) nat) + ((unsyntax (racketidfont "-")) nat)])]{ -In a @tech{top-level context}, @scheme[require] @tech{instantiates} +In a @tech{top-level context}, @racket[require] @tech{instantiates} modules (see @secref["module-eval-model"]). In a @tech{top-level -context} or @tech{module context}, expansion of @scheme[require] +context} or @tech{module context}, expansion of @racket[require] @tech{visits} modules (see @secref["mod-parse"]). In both contexts and -both evaluation and expansion, @scheme[require] introduces bindings +both evaluation and expansion, @racket[require] introduces bindings into a @tech{namespace} or a module (see @secref["intro-binding"]). A -@scheme[require] form in a @tech{expression context} or +@racket[require] form in a @tech{expression context} or @tech{internal-definition context} is a syntax error. -A @scheme[require-spec] designates a particular set of identifiers to +A @racket[require-spec] designates a particular set of identifiers to be bound in the importing context. Each identifier is mapped to a particular export of a particular module; the identifier to bind may be different from the symbolic name of the originally exported identifier. Each identifier also binds at a particular @tech{phase level}. -The syntax of @scheme[require-spec] can be extended via -@scheme[define-require-syntax], and when multiple -@scheme[require-spec]s are specified in a @scheme[require], the -bindings of each @scheme[require-spec] are visible for expanding later -@scheme[require-spec]s. The pre-defined forms (as exported by -@scheme[racket/base]) are as follows: +The syntax of @racket[require-spec] can be extended via +@racket[define-require-syntax], and when multiple +@racket[require-spec]s are specified in a @racket[require], the +bindings of each @racket[require-spec] are visible for expanding later +@racket[require-spec]s. The pre-defined forms (as exported by +@racketmodname[racket/base]) are as follows: @specsubform[module-path]{ Imports all exported bindings from the named module, using the export identifiers as the local identifiers. - (See below for information on @scheme[module-path].) The lexical - context of the @scheme[module-path] form determines the context of + (See below for information on @racket[module-path].) The lexical + context of the @racket[module-path] form determines the context of the introduced identifiers.} @defsubform[(only-in require-spec id-maybe-renamed ...)]{ - Like @scheme[require-spec], but constrained to those exports for - which the identifiers to bind match @scheme[id-maybe-renamed]: as - @scheme[_id] or as @scheme[_orig-id] in @scheme[[_orig-id _bind-id]]. If - the @scheme[_id] or @scheme[_orig-id] of any @scheme[id-maybe-renamed] - is not in the set that @scheme[require-spec] describes, a syntax + Like @racket[require-spec], but constrained to those exports for + which the identifiers to bind match @racket[id-maybe-renamed]: as + @racket[_id] or as @racket[_orig-id] in @racket[[_orig-id _bind-id]]. If + the @racket[_id] or @racket[_orig-id] of any @racket[id-maybe-renamed] + is not in the set that @racket[require-spec] describes, a syntax error is reported. @defexamples[#:eval (syntax-eval) (require (only-in racket/tcp tcp-listen - (tcp-accept my-accept))) + [tcp-accept my-accept])) tcp-listen my-accept tcp-accept ]} @defsubform[(except-in require-spec id ...)]{ Like - @scheme[require-spec], but omitting those imports for which - @scheme[id]s are the identifiers to bind; if any @scheme[id] is not - in the set that @scheme[require-spec] describes, a syntax error is + @racket[require-spec], but omitting those imports for which + @racket[id]s are the identifiers to bind; if any @racket[id] is not + in the set that @racket[require-spec] describes, a syntax error is reported. @defexamples[#:eval (syntax-eval) @@ -336,9 +336,9 @@ bindings of each @scheme[require-spec] are visible for expanding later ]} @defsubform[(prefix-in prefix-id require-spec)]{ Like - @scheme[require-spec], but adjusting each identifier to be bound by - prefixing it with @scheme[prefix-id]. The lexical context of the - @scheme[prefix-id] is ignored, and instead preserved from the + @racket[require-spec], but adjusting each identifier to be bound by + prefixing it with @racket[prefix-id]. The lexical context of the + @racket[prefix-id] is ignored, and instead preserved from the identifiers before prefixing. @defexamples[#:eval (syntax-eval) @@ -348,9 +348,9 @@ bindings of each @scheme[require-spec] are visible for expanding later ]} @defsubform[(rename-in require-spec [orig-id bind-id] ...)]{ - Like @scheme[require-spec], but replacing the identifier to - bind @scheme[orig-id] with @scheme[bind-id]; if any - @scheme[orig-id] is not in the set that @scheme[require-spec] + Like @racket[require-spec], but replacing the identifier to + bind @racket[orig-id] with @racket[bind-id]; if any + @racket[orig-id] is not in the set that @racket[require-spec] describes, a syntax error is reported. @defexamples[#:eval (syntax-eval) @@ -362,7 +362,7 @@ bindings of each @scheme[require-spec] are visible for expanding later ]} @defsubform[(combine-in require-spec ...)]{ - The union of the @scheme[require-spec]s. + The union of the @racket[require-spec]s. @defexamples[#:eval (syntax-eval) (require (combine-in (only-in racket/tcp tcp-accept) @@ -372,15 +372,15 @@ bindings of each @scheme[require-spec] are visible for expanding later ]} @defsubform[(only-meta-in phase-level require-spec ...)]{ - Like the combination of @scheme[require-spec]s, but removing any - binding that is not for @scheme[phase-level], where @scheme[#f] for - @scheme[phase-level] corresponds to the @tech{label phase level}. + Like the combination of @racket[require-spec]s, but removing any + binding that is not for @racket[phase-level], where @racket[#f] for + @racket[phase-level] corresponds to the @tech{label phase level}. The following example imports bindings only at @tech{phase level} 1, the transform phase: @interaction[#:eval meta-in-eval - (module nest scheme + (module nest racket (provide (for-syntax meta-eggs) (for-meta 1 meta-chicks) num-eggs) @@ -408,13 +408,13 @@ bindings of each @scheme[require-spec] are visible for expanding later @specsubform[#:literals (for-meta) (for-meta phase-level require-spec ...)]{Like the combination of - @scheme[require-spec]s, but constrained each binding specified by - each @scheme[require-spec] is shifted by @scheme[phase-level]. The - @tech{label phase level} corresponds to @scheme[#f], and a shifting - combination that involves @scheme[#f] produces @scheme[#f]. + @racket[require-spec]s, but constrained each binding specified by + each @racket[require-spec] is shifted by @racket[phase-level]. The + @tech{label phase level} corresponds to @racket[#f], and a shifting + combination that involves @racket[#f] produces @racket[#f]. @defexamples[#:eval (syntax-eval) - (module nest scheme + (module nest racket (provide num-eggs) (define num-eggs 2)) (require (for-meta 0 'nest)) @@ -427,43 +427,43 @@ bindings of each @scheme[require-spec] are visible for expanding later @specsubform[#:literals (for-syntax) (for-syntax require-spec ...)]{Same as - @scheme[(for-meta 1 require-spec ...)].} + @racket[(for-meta 1 require-spec ...)].} @specsubform[#:literals (for-template) (for-template require-spec ...)]{Same as - @scheme[(for-meta -1 require-spec ...)].} + @racket[(for-meta -1 require-spec ...)].} @specsubform[#:literals (for-label) (for-label require-spec ...)]{Same as - @scheme[(for-meta #f require-spec ...)].} + @racket[(for-meta #f require-spec ...)].} - @specsubform[derived-require-spec]{See @scheme[define-require-syntax] - for information on expanding the set of @scheme[require-spec] + @specsubform[derived-require-spec]{See @racket[define-require-syntax] + for information on expanding the set of @racket[require-spec] forms.} @guideintro["module-paths"]{module paths} -A @scheme[module-path] identifies a module, either through a concrete +A @racket[module-path] identifies a module, either through a concrete name in the form of an identifier, or through an indirect name that can trigger automatic loading of the module declaration. Except for -the @scheme[id] case below, the actual resolution is up to the current +the @racket[id] case below, the actual resolution is up to the current @tech{module name resolver} (see -@scheme[current-module-name-resolver]), and the description below +@racket[current-module-name-resolver]), and the description below corresponds to the default @tech{module name resolver}. @specsubform[#:literals (quote) - (#,(scheme quote) id)]{ + (#,(racket quote) id)]{ Refers to a module previously declared interactively with the name - @scheme[id]. + @racket[id]. @examples[ - (code:comment @#,t{a module declared interactively as @schemeidfont{test}:}) - (eval:alts (require '@#,schemeidfont{test}) (void))]} + (code:comment @#,t{a module declared interactively as @racketidfont{test}:}) + (eval:alts (require '@#,racketidfont{test}) (void))]} @specsubform[rel-string]{A path relative to the containing source (as - determined by @scheme[current-load-relative-directory] or - @scheme[current-directory]). Regardless of the current platform, - @scheme[rel-string] is always parsed as a Unix-format relative path: + determined by @racket[current-load-relative-directory] or + @racket[current-directory]). Regardless of the current platform, + @racket[rel-string] is always parsed as a Unix-format relative path: @litchar{/} is the path delimiter (multiple adjacent @litchar{/}s are treated as a single delimiter), @litchar{..} accesses the parent directory, and @litchar{.} accesses the current directory. The path @@ -482,7 +482,7 @@ corresponds to the default @tech{module name resolver}. UTF-8 encoding). Such encodings are not decoded to arrive at a filename, but instead preserved in the file access.} - If @scheme[rel-string] ends with a @filepath{.ss} suffix, it is + If @racket[rel-string] ends with a @filepath{.ss} suffix, it is converted to a @filepath{.rkt} suffix. The @tech{compiled-load handler} may reverse that conversion if a @filepath{.rkt} file does not exist and a @filepath{.ss} exists. @@ -496,28 +496,28 @@ corresponds to the default @tech{module name resolver}. (eval:alts (require "../x.rkt") (void))]} @defsubform[(lib rel-string ...+)]{A path to a module installed into - a @tech{collection} (see @secref["collects"]). The @scheme[rel-string]s in - @scheme[lib] are constrained similar to the plain @scheme[rel-string] - case, with the additional constraint that a @scheme[rel-string] + a @tech{collection} (see @secref["collects"]). The @racket[rel-string]s in + @racket[lib] are constrained similar to the plain @racket[rel-string] + case, with the additional constraint that a @racket[rel-string] cannot contain @litchar{.} or @litchar{..} directory indicators. The specific interpretation of the path depends on the number and - shape of the @scheme[rel-string]s: + shape of the @racket[rel-string]s: @itemize[ - @item{If a single @scheme[rel-string] is provided, and if it + @item{If a single @racket[rel-string] is provided, and if it consists of a single element (i.e., no @litchar{/}) with no file - suffix (i.e., no @litchar{.}), then @scheme[rel-string] names a + suffix (i.e., no @litchar{.}), then @racket[rel-string] names a @tech{collection}, and @filepath{main.rkt} is the library file name. @examples[ - (code:comment @#,t{the main @schememodname[swindle] library:}) + (code:comment @#,t{the main @racketmodname[swindle] library:}) (eval:alts (require (lib "swindle")) (void)) (code:comment @#,t{the same:}) (eval:alts (require (lib "swindle/main.rkt")) (void))]} - @item{If a single @scheme[rel-string] is provided, and if it + @item{If a single @racket[rel-string] is provided, and if it consists of multiple @litchar{/}-separated elements, then each element up to the last names a @tech{collection}, subcollection, etc., and the last element names a file. If the last element has @@ -532,42 +532,42 @@ corresponds to the default @tech{module name resolver}. (code:comment @#,t{the same:}) (eval:alts (require (lib "swindle/turbo.ss")) (void))]} - @item{If a single @scheme[rel-string] is provided, and if it + @item{If a single @racket[rel-string] is provided, and if it consists of a single element @italic{with} a file suffix (i.e, - with a @litchar{.}), then @scheme[rel-string] names a file within + with a @litchar{.}), then @racket[rel-string] names a file within the @filepath{mzlib} @tech{collection}. A @filepath{.ss} suffix is converted to @filepath{.rkt}. (This convention is for - compatibility with older version of PLT Scheme.) + compatibility with older version of PLT Racket.) @examples[ (code:comment @#,t{@filepath{tar.rkt} module from the @filepath{mzlib} collection:}) (eval:alts (require (lib "tar.ss")) (void))]} - @item{Otherwise, when multiple @scheme[rel-string]s are provided, - the first @scheme[rel-string] is effectively moved after the - others, and all @scheme[rel-string]s are appended with @litchar{/} + @item{Otherwise, when multiple @racket[rel-string]s are provided, + the first @racket[rel-string] is effectively moved after the + others, and all @racket[rel-string]s are appended with @litchar{/} separators. The resulting path names a @tech{collection}, then subcollection, etc., ending with a file name. No suffix is added automatically, but a @filepath{.ss} suffix is converted to @filepath{.rkt}. (This convention is for compatibility with older - version of PLT Scheme.) + version of PLT Racket.) @examples[ (code:comment @#,t{@filepath{tar.rkt} module from the @filepath{mzlib} collection:}) (eval:alts (require (lib "tar.ss" "mzlib")) (void))]} ]} - @specsubform[id]{A shorthand for a @scheme[lib] form with a single - @scheme[_rel-string] whose characters are the same as in the symbolic - form of @scheme[id]. In addition to the constraints of a @scheme[lib] - @scheme[_rel-string], @scheme[id] must not contain @litchar{.}. + @specsubform[id]{A shorthand for a @racket[lib] form with a single + @racket[_rel-string] whose characters are the same as in the symbolic + form of @racket[id]. In addition to the constraints of a @racket[lib] + @racket[_rel-string], @racket[id] must not contain @litchar{.}. @examples[#:eval require-eval (eval:alts (require racket/tcp) (void))]} - @defsubform[(file string)]{Similar to the plain @scheme[rel-string] - case, but @scheme[string] is a path---possibly absolute---using the - current platform's path conventions and @scheme[expand-user-path]. + @defsubform[(file string)]{Similar to the plain @racket[rel-string] + case, but @racket[string] is a path---possibly absolute---using the + current platform's path conventions and @racket[expand-user-path]. A @filepath{.ss} suffix is converted to @filepath{.rkt}. @examples[(eval:alts (require (file "~/tmp/x.rkt")) (void))]} @@ -579,7 +579,7 @@ corresponds to the default @tech{module name resolver}. Specifies a library available via the @PLaneT server. - The first form is a shorthand for the last one, where the @scheme[id]'s + The first form is a shorthand for the last one, where the @racket[id]'s character sequence must match the following @nonterm{spec} grammar: @BNF[ @@ -610,24 +610,24 @@ corresponds to the default @tech{module name resolver}. @nonterm{path}; if no @nonterm{path} is included, @filepath{main.rkt} is used in the expansion. - A @scheme[(planet string)] form is like a @scheme[(planet id)] form + A @racket[(planet string)] form is like a @racket[(planet id)] form with the identifier converted to a string, except that the - @scheme[string] can optionally end with a file extension (i.e., a + @racket[string] can optionally end with a file extension (i.e., a @litchar{.}) for a @nonterm{path}. A @filepath{.ss} file extension is converted to @filepath{.rkt}. - In the more general last form of a @scheme[planet] module path, the - @scheme[rel-string]s are similar to the @scheme[lib] form, except - that the @scheme[(user-string pkg-string vers)] names a + In the more general last form of a @racket[planet] module path, the + @racket[rel-string]s are similar to the @racket[lib] form, except + that the @racket[(user-string pkg-string vers)] names a @|PLaneT|-based package instead of a @tech{collection}. A version specification can include an optional major and minor version, where the minor version can be a specific number or a constraint: - @scheme[(_nat _nat)] specifies an inclusive range, @scheme[((unsyntax - (schemeidfont "=")) _nat)] specifies an exact match, - @scheme[((unsyntax (schemeidfont "+")) _nat)] specifies a minimum - version and is equivalent to just @scheme[_nat], and - @scheme[((unsyntax (schemeidfont "-")) _nat)] specifies a maximum - version. The @schemeidfont{=}, @schemeidfont{+}, and @schemeidfont{-} + @racket[(_nat _nat)] specifies an inclusive range, @racket[((unsyntax + (racketidfont "=")) _nat)] specifies an exact match, + @racket[((unsyntax (racketidfont "+")) _nat)] specifies a minimum + version and is equivalent to just @racket[_nat], and + @racket[((unsyntax (racketidfont "-")) _nat)] specifies a maximum + version. The @racketidfont{=}, @racketidfont{+}, and @racketidfont{-} identifiers in a minor-version constraint are recognized symbolically. @@ -649,7 +649,7 @@ an identifier can be either imported or defined for a given @tech{phase level}, but not both.} -@guideintro["module-provide"]{@scheme[provide]} +@guideintro["module-provide"]{@racket[provide]} @defform/subs[#:literals (protect-out all-defined-out all-from-out rename-out except-out prefix-out struct-out for-meta combine-out @@ -671,54 +671,54 @@ an identifier can be either imported or defined for a given derived-provide-spec] [phase-level exact-integer #f])]{ -Declares exports from a module. A @scheme[provide] form must appear in +Declares exports from a module. A @racket[provide] form must appear in a @tech{module context} or a @tech{module-begin context}. -A @scheme[provide-spec] indicates one or more bindings to provide. +A @racket[provide-spec] indicates one or more bindings to provide. For each exported binding, the external name is a symbol that can be different from the symbolic form of the identifier that is bound within the module. Also, each export is drawn from a particular @tech{phase level} and exported at the same @tech{phase level}. -The syntax of @scheme[provide-spec] can be extended via -@scheme[define-provide-syntax], but the pre-defined forms are as +The syntax of @racket[provide-spec] can be extended via +@racket[define-provide-syntax], but the pre-defined forms are as follows. - @specsubform[id]{ Exports @scheme[id], which must be @tech{bound} + @specsubform[id]{ Exports @racket[id], which must be @tech{bound} within the module (i.e., either defined or imported) at the relevant - @tech{phase level}. The symbolic form of @scheme[id] is used as the + @tech{phase level}. The symbolic form of @racket[id] is used as the external name, and the symbolic form of the defined or imported identifier must match (otherwise, the external name could be ambiguous). @defexamples[#:eval (syntax-eval) - (module nest scheme + (module nest racket (provide num-eggs) (define num-eggs 2)) (require 'nest) num-eggs ] - If @scheme[id] has a transformer binding to a @tech{rename + If @racket[id] has a transformer binding to a @tech{rename transformer}, then the exported binding is the target identifier of - the @tech{rename transformer}, instead of @scheme[id], unless the + the @tech{rename transformer}, instead of @racket[id], unless the target identifier has a true value for the - @scheme['not-free-identifier=?] @tech{syntax property}.} + @racket['not-free-identifier=?] @tech{syntax property}.} @defsubform[(all-defined-out)]{ Exports all identifiers that are defined at @tech{phase level} 0 or @tech{phase level} 1 within the exporting module, and that have the same lexical context as the - @scheme[(all-defined-out)] form, excluding bindings to @tech{rename + @racket[(all-defined-out)] form, excluding bindings to @tech{rename transformers} where the target identifier has the - @scheme['not-provide-all-defined] @tech{syntax property}. The + @racket['not-provide-all-defined] @tech{syntax property}. The external name for each identifier is the symbolic form of the identifier. Only identifiers accessible from the lexical context of - the @scheme[(all-defined-out)] form are included; that is, + the @racket[(all-defined-out)] form are included; that is, macro-introduced imports are not re-exported, unless the - @scheme[(all-defined-out)] form was introduced at the same time. + @racket[(all-defined-out)] form was introduced at the same time. @defexamples[#:eval (syntax-eval) - (module nest scheme + (module nest racket (provide (all-defined-out)) (define num-eggs 2)) (require 'nest) @@ -727,20 +727,20 @@ follows. @defsubform[(all-from-out module-path ...)]{ Exports all identifiers that are imported into the exporting module using a - @scheme[require-spec] built on each @scheme[module-path] (see + @racket[require-spec] built on each @racket[module-path] (see @secref["require"]) with no @tech{phase-level} shift. The symbolic name for export is derived from the name that is bound within the module, as opposed to the symbolic name of the export from each - @scheme[module-path]. Only identifiers accessible from the lexical - context of the @scheme[module-path] are included; that is, + @racket[module-path]. Only identifiers accessible from the lexical + context of the @racket[module-path] are included; that is, macro-introduced imports are not re-exported, unless the - @scheme[module-path] was introduced at the same time. + @racket[module-path] was introduced at the same time. @defexamples[#:eval (syntax-eval) - (module nest scheme + (module nest racket (provide num-eggs) (define num-eggs 2)) - (module hen-house scheme + (module hen-house racket (require 'nest) (provide (all-from-out 'nest))) (require 'hen-house) @@ -748,12 +748,12 @@ follows. ]} @defsubform[(rename-out [orig-id export-id] ...)]{ Exports each - @scheme[orig-id], which must be @tech{bound} within the module at + @racket[orig-id], which must be @tech{bound} within the module at @tech{phase level} 0. The symbolic name for each export is - @scheme[export-id] instead @scheme[orig-d]. + @racket[export-id] instead @racket[orig-d]. @defexamples[#:eval (syntax-eval) - (module nest scheme + (module nest racket (provide (rename-out [count num-eggs])) (define count 2)) (require 'nest) @@ -762,14 +762,14 @@ follows. ]} @defsubform[(except-out provide-spec provide-spec ...)]{ Like the - first @scheme[provide-spec], but omitting the bindings listed in each - subsequent @scheme[provide-spec]. If one of the latter bindings is - not included in the initial @scheme[provide-spec], a syntax error is + first @racket[provide-spec], but omitting the bindings listed in each + subsequent @racket[provide-spec]. If one of the latter bindings is + not included in the initial @racket[provide-spec], a syntax error is reported. The symbolic export name information in the latter - @scheme[provide-spec]s is ignored; only the bindings are used. + @racket[provide-spec]s is ignored; only the bindings are used. @defexamples[#:eval (syntax-eval) - (module nest scheme + (module nest racket (provide (except-out (all-defined-out) num-chicks)) (define num-eggs 2) @@ -780,11 +780,11 @@ follows. ]} @defsubform[(prefix-out prefix-id provide-spec)]{ - Like @scheme[provide-spec], but with each symbolic export name from - @scheme[provide-spec] prefixed with @scheme[prefix-id]. + Like @racket[provide-spec], but with each symbolic export name from + @racket[provide-spec] prefixed with @racket[prefix-id]. @defexamples[#:eval (syntax-eval) - (module nest scheme + (module nest racket (provide (prefix-out chicken: num-eggs)) (define num-eggs 2)) (require 'nest) @@ -792,32 +792,31 @@ follows. ]} @defsubform[(struct-out id)]{Exports the bindings associated with a - structure type @scheme[id]. Typically, @scheme[id] is bound with - @scheme[(define-struct id ....)] or @scheme[(define-struct (id - _super-id) ....)]; more generally, @scheme[id] must have a + structure type @racket[id]. Typically, @racket[id] is bound with + @racket[(struct id ....)]; more generally, @racket[id] must have a @tech{transformer binding} of structure-type information at @tech{phase level} 0; see @secref["structinfo"]. Furthermore, for each identifier mentioned in the structure-type information, the enclosing module must define or import one identifier that is - @scheme[free-identifier=?]. If the structure-type information + @racket[free-identifier=?]. If the structure-type information includes a super-type identifier, and if the identifier has a @tech{transformer binding} of structure-type information, the accessor and mutator bindings of the super-type are @italic{not} - included by @scheme[struct-out] for export. + included by @racket[struct-out] for export. @defexamples[#:eval (syntax-eval) - (module nest scheme + (module nest racket (provide (struct-out egg)) - (define-struct egg (color wt))) + (struct egg (color wt))) (require 'nest) - (egg-color (make-egg 'blue 10)) + (egg-color (egg 'blue 10)) ]} @defsubform[(combine-out provide-spec ...)]{ The union of the - @scheme[provide-spec]s. + @racket[provide-spec]s. @defexamples[#:eval (syntax-eval) - (module nest scheme + (module nest racket (provide (combine-out num-eggs num-chicks)) (define num-eggs 2) (define num-chicks 1)) @@ -827,12 +826,12 @@ follows. ]} @defsubform[(protect-out provide-spec ...)]{ Like the union of the - @scheme[provide-spec]s, except that the exports are protected; see - @secref["modprotect"]. The @scheme[provide-spec] must specify only + @racket[provide-spec]s, except that the exports are protected; see + @secref["modprotect"]. The @racket[provide-spec] must specify only bindings that are defined within the exporting module. @examples[#:eval (syntax-eval) - (module nest scheme + (module nest racket (provide num-eggs (protect-out num-chicks)) (define num-eggs 2) (define num-chicks 3)) @@ -848,16 +847,16 @@ follows. @specsubform[#:literals (for-meta) (for-meta phase-level provide-spec ...)]{ Like the union of the - @scheme[provide-spec]s, but adjusted to apply to @tech{phase level} - specified by @scheme[phase-level] (where @scheme[#f] corresponds to the - @tech{label phase level}). In particular, an @scheme[_id] or @scheme[rename-out] form as - a @scheme[provide-spec] refers to a binding at @scheme[phase-level], an - @scheme[all-defined-out] exports only @scheme[phase-level] - definitions, and an @scheme[all-from-out] exports bindings - imported with a shift by @scheme[phase-level]. + @racket[provide-spec]s, but adjusted to apply to @tech{phase level} + specified by @racket[phase-level] (where @racket[#f] corresponds to the + @tech{label phase level}). In particular, an @racket[_id] or @racket[rename-out] form as + a @racket[provide-spec] refers to a binding at @racket[phase-level], an + @racket[all-defined-out] exports only @racket[phase-level] + definitions, and an @racket[all-from-out] exports bindings + imported with a shift by @racket[phase-level]. @examples[#:eval (syntax-eval) - (module nest scheme + (module nest racket (define-for-syntax eggs 2) (define chickens 3) (provide (for-syntax eggs) @@ -869,13 +868,13 @@ follows. (test-eggs) chickens - (module broken-nest scheme + (module broken-nest racket (define eggs 2) (define chickens 3) (provide (for-syntax eggs) chickens)) - (module nest2 scheme + (module nest2 racket (define-for-syntax eggs 2) (provide (for-syntax eggs))) (require (for-meta 2 racket/base) @@ -892,136 +891,136 @@ follows. @specsubform[#:literals (for-syntax) (for-syntax provide-spec ...)]{Same as - @scheme[(for-meta 1 provide-spec ...)].} + @racket[(for-meta 1 provide-spec ...)].} @specsubform[#:literals (for-template) (for-template provide-spec ...)]{Same as - @scheme[(for-meta -1 provide-spec ...)].} + @racket[(for-meta -1 provide-spec ...)].} @specsubform[#:literals (for-label) (for-label provide-spec ...)]{Same as - @scheme[(for-meta #f provide-spec ...)].} + @racket[(for-meta #f provide-spec ...)].} - @specsubform[derived-provide-spec]{See @scheme[define-provide-syntax] - for information on expanding the set of @scheme[provide-spec] forms.} + @specsubform[derived-provide-spec]{See @racket[define-provide-syntax] + for information on expanding the set of @racket[provide-spec] forms.} Each export specified within a module must have a distinct symbolic export name, though the same binding can be specified with the multiple symbolic names.} -@defform[(for-meta phase-level require-spec ...)]{See @scheme[require] and @scheme[provide].} -@defform[(for-syntax require-spec ...)]{See @scheme[require] and @scheme[provide].} @defform[(for-template require-spec ...)]{See @scheme[require] and @scheme[provide].} -@defform[(for-label require-spec ...)]{See @scheme[require] and @scheme[provide].} +@defform[(for-meta phase-level require-spec ...)]{See @racket[require] and @racket[provide].} +@defform[(for-syntax require-spec ...)]{See @racket[require] and @racket[provide].} @defform[(for-template require-spec ...)]{See @racket[require] and @racket[provide].} +@defform[(for-label require-spec ...)]{See @racket[require] and @racket[provide].} @defform/subs[(#%require raw-require-spec ...) ([raw-require-spec phaseless-spec - (#,(schemeidfont "for-meta") phase-level phaseless-spec ...) - (#,(schemeidfont "for-syntax") phaseless-spec ...) - (#,(schemeidfont "for-template") phaseless-spec ...) - (#,(schemeidfont "for-label") phaseless-spec ...) - (#,(schemeidfont "just-meta") phase-level raw-require-spec ...)] + (#,(racketidfont "for-meta") phase-level phaseless-spec ...) + (#,(racketidfont "for-syntax") phaseless-spec ...) + (#,(racketidfont "for-template") phaseless-spec ...) + (#,(racketidfont "for-label") phaseless-spec ...) + (#,(racketidfont "just-meta") phase-level raw-require-spec ...)] [phase-level exact-integer #f] [phaseless-spec raw-module-path - (#,(schemeidfont "only") raw-module-path id ...) - (#,(schemeidfont "prefix") prefix-id raw-module-path) - (#,(schemeidfont "all-except") raw-module-path id ...) - (#,(schemeidfont "prefix-all-except") prefix-id + (#,(racketidfont "only") raw-module-path id ...) + (#,(racketidfont "prefix") prefix-id raw-module-path) + (#,(racketidfont "all-except") raw-module-path id ...) + (#,(racketidfont "prefix-all-except") prefix-id raw-module-path id ...) - (#,(schemeidfont "rename") raw-module-path local-id exported-id)] - [raw-module-path (#,(schemeidfont "quote") id) + (#,(racketidfont "rename") raw-module-path local-id exported-id)] + [raw-module-path (#,(racketidfont "quote") id) rel-string - (#,(schemeidfont "lib") rel-string ...) + (#,(racketidfont "lib") rel-string ...) id - (#,(schemeidfont "file") string) - (#,(schemeidfont "planet") rel-string + (#,(racketidfont "file") string) + (#,(racketidfont "planet") rel-string (user-string pkg-string vers ...))])]{ -The primitive import form, to which @scheme[require] expands. A -@scheme[raw-require-spec] is similar to a @scheme[_require-spec] in a -@scheme[require] form, except that the syntax is more constrained, not +The primitive import form, to which @racket[require] expands. A +@racket[raw-require-spec] is similar to a @racket[_require-spec] in a +@racket[require] form, except that the syntax is more constrained, not composable, and not extensible. Also, sub-form names like -@schemeidfont{for-syntax} and @schemeidfont{lib} are recognized +@racketidfont{for-syntax} and @racketidfont{lib} are recognized symbolically, instead of via bindings. Although not formalized in the -grammar above, a @schemeidfont{just-meta} form cannot appear within a -@schemeidfont{just-meta} form. +grammar above, a @racketidfont{just-meta} form cannot appear within a +@racketidfont{just-meta} form. -Each @scheme[raw-require-spec] corresponds to the obvious -@scheme[_require-spec], but the @schemeidfont{rename} sub-form has the -identifiers in reverse order compared to @scheme[rename-in]. +Each @racket[raw-require-spec] corresponds to the obvious +@racket[_require-spec], but the @racketidfont{rename} sub-form has the +identifiers in reverse order compared to @racket[rename-in]. -For most @scheme[raw-require-spec]s, the lexical context of the -@scheme[raw-require-spec] determines the context of introduced -identifiers. The exception is the @schemeidfont{rename} sub-form, -where the lexical context of the @scheme[local-id] is preserved.} +For most @racket[raw-require-spec]s, the lexical context of the +@racket[raw-require-spec] determines the context of introduced +identifiers. The exception is the @racketidfont{rename} sub-form, +where the lexical context of the @racket[local-id] is preserved.} @defform/subs[(#%provide raw-provide-spec ...) ([raw-provide-spec phaseless-spec - (#,(schemeidfont "for-meta") phase-level phaseless-spec) - (#,(schemeidfont "for-syntax") phaseless-spec) - (#,(schemeidfont "for-label") phaseless-spec) - (#,(schemeidfont "protect") raw-provide-spec)] + (#,(racketidfont "for-meta") phase-level phaseless-spec) + (#,(racketidfont "for-syntax") phaseless-spec) + (#,(racketidfont "for-label") phaseless-spec) + (#,(racketidfont "protect") raw-provide-spec)] [phase-level exact-integer #f] [phaseless-spec id - (#,(schemeidfont "rename") local-id export-id) - (#,(schemeidfont "struct") struct-id (field-id ...)) - (#,(schemeidfont "all-from") raw-module-path) - (#,(schemeidfont "all-from-except") raw-module-path id ...) - (#,(schemeidfont "all-defined")) - (#,(schemeidfont "all-defined-except") id ...) - (#,(schemeidfont "prefix-all-defined") prefix-id) - (#,(schemeidfont "prefix-all-defined-except") prefix-id id ...) - (#,(schemeidfont "protect") phaseless-spec ...) - (#,(schemeidfont "expand") (id . datum))])]{ + (#,(racketidfont "rename") local-id export-id) + (#,(racketidfont "struct") struct-id (field-id ...)) + (#,(racketidfont "all-from") raw-module-path) + (#,(racketidfont "all-from-except") raw-module-path id ...) + (#,(racketidfont "all-defined")) + (#,(racketidfont "all-defined-except") id ...) + (#,(racketidfont "prefix-all-defined") prefix-id) + (#,(racketidfont "prefix-all-defined-except") prefix-id id ...) + (#,(racketidfont "protect") phaseless-spec ...) + (#,(racketidfont "expand") (id . datum))])]{ -The primitive export form, to which @scheme[provide] expands. A -@scheme[_raw-module-path] is as for @scheme[#%require]. A -@schemeidfont{protect} sub-form cannot appear within a -@scheme[protect] sub-form. +The primitive export form, to which @racket[provide] expands. A +@racket[_raw-module-path] is as for @racket[#%require]. A +@racketidfont{protect} sub-form cannot appear within a +@racket[protect] sub-form. -Like @scheme[#%require], the sub-form keywords for @scheme[#%provide] +Like @racket[#%require], the sub-form keywords for @racket[#%provide] are recognized symbolically, and nearly every -@scheme[raw-provide-spec] has an obvious equivalent -@scheme[_provide-spec] via @scheme[provide], with the exception of the -@schemeidfont{struct} and @schemeidfont{expand} sub-forms. +@racket[raw-provide-spec] has an obvious equivalent +@racket[_provide-spec] via @racket[provide], with the exception of the +@racketidfont{struct} and @racketidfont{expand} sub-forms. -A @scheme[(#,(schemeidfont "struct") struct-id (field-id ...))] -sub-form expands to @scheme[struct-id], -@schemeidfont{make-}@scheme[struct-id], -@schemeidfont{struct:}@scheme[struct-id], -@scheme[struct-id]@schemeidfont{?}, -@scheme[struct-id]@schemeidfont{-}@scheme[field-id] for each -@scheme[field-id], and -@schemeidfont{set-}@scheme[struct-id]@schemeidfont{-}@scheme[field-id]@schemeidfont{!} -for each @scheme[field-id]. The lexical context of the -@scheme[struct-id] is used for all generated identifiers. +A @racket[(#,(racketidfont "struct") struct-id (field-id ...))] +sub-form expands to @racket[struct-id], +@racketidfont{make-}@racket[struct-id], +@racketidfont{struct:}@racket[struct-id], +@racket[struct-id]@racketidfont{?}, +@racket[struct-id]@racketidfont{-}@racket[field-id] for each +@racket[field-id], and +@racketidfont{set-}@racket[struct-id]@racketidfont{-}@racket[field-id]@racketidfont{!} +for each @racket[field-id]. The lexical context of the +@racket[struct-id] is used for all generated identifiers. -Unlike @scheme[#%require], the @scheme[#%provide] form is -macro-extensible via an explicit @schemeidfont{expand} sub-form; the -@scheme[(id . datum)] part is locally expanded as an expression (even +Unlike @racket[#%require], the @racket[#%provide] form is +macro-extensible via an explicit @racketidfont{expand} sub-form; the +@racket[(id . datum)] part is locally expanded as an expression (even though it is not actually an expression), stopping when a -@scheme[begin] form is produced; if the expansion result is -@scheme[(begin raw-provide-spec ...)], it is spliced in place of the -@schemeidfont{expand} form, otherwise a syntax error is reported. The -@schemeidfont{expand} sub-form is not normally used directly; it -provides a hook for implementing @scheme[provide] and @tech{provide +@racket[begin] form is produced; if the expansion result is +@racket[(begin raw-provide-spec ...)], it is spliced in place of the +@racketidfont{expand} form, otherwise a syntax error is reported. The +@racketidfont{expand} sub-form is not normally used directly; it +provides a hook for implementing @racket[provide] and @tech{provide transformers}. -The @schemeidfont{all-from} and @schemeidfont{all-from-except} forms +The @racketidfont{all-from} and @racketidfont{all-from-except} forms re-export only identifiers that are accessible in lexical context of -the @schemeidfont{all-from} or @schemeidfont{all-from-except} form +the @racketidfont{all-from} or @racketidfont{all-from-except} form itself. That is, macro-introduced imports are not re-exported, unless -the @schemeidfont{all-from} or @schemeidfont{all-from-except} form was -introduced at the same time. Similarly, @schemeidfont{all-defined} and +the @racketidfont{all-from} or @racketidfont{all-from-except} form was +introduced at the same time. Similarly, @racketidfont{all-defined} and its variants export only definitions accessible from the lexical -context of the @scheme[phaseless-spec] form.} +context of the @racket[phaseless-spec] form.} @; -------------------- -@subsection{Additional @scheme[require] Forms} +@subsection{Additional @racket[require] Forms} @note-lib-only[racket/require] @@ -1029,8 +1028,8 @@ The following forms support more complex selection and manipulation of sets of imported identifiers. @defform[(matching-identifiers-in regexp require-spec)]{ Like - @scheme[require-spec], but including only imports whose names match - @scheme[regexp]. The @scheme[regexp] must be a literal regular + @racket[require-spec], but including only imports whose names match + @racket[regexp]. The @racket[regexp] must be a literal regular expression (see @secref["regexp"]). @defexamples[#:eval (syntax-eval) @@ -1052,21 +1051,21 @@ monkey ]} @defform[(subtract-in require-spec subtracted-spec ...)]{ Like - @scheme[require-spec], but omitting those imports that would be - imported by one of the @scheme[subtracted-spec]s. + @racket[require-spec], but omitting those imports that would be + imported by one of the @racket[subtracted-spec]s. @defexamples[#:eval (syntax-eval) -(module earth scheme +(module earth racket (provide land sea air) (define land 1) (define sea 2) (define air 3)) -(module mars scheme +(module mars racket (provide aliens) (define aliens 4)) -(module solar-system scheme +(module solar-system racket (require 'earth 'mars) (provide (all-from-out 'earth) (all-from-out 'mars))) @@ -1077,40 +1076,39 @@ land aliens ]} -@defform[(filtered-in proc-expr require-spec)]{ The @scheme[proc-expr] - should evaluate to a single-argument procedure, which is applied on - each of the names (as strings) that are to be required according to - @scheme[require-spec]. For each name, the procedure should return - either a string (possibly different if you want it renamed), or - @scheme[#f] to exclude the name. (Note that @scheme[proc-expr] is a - syntax-time expression.) +@defform[(filtered-in proc-expr require-spec)]{ + + Applies an arbitrary transformation on the import names (as strings) + of @scheme[require-spec]. The @racket[proc-expr] must evaluate at + expansion time to a single-argument procedure, which is applied on + each of the names from @racket[require-spec]. For each name, the + procedure must return either a string for the import's new name or + @racket[#f] to exclude the import. For example, - @schemeblock[ + @racketblock[ (require (filtered-in (lambda (name) (and (regexp-match? #rx"^[a-z-]+$" name) - (regexp-replace - #rx"-" (string-titlecase name) ""))) + (regexp-replace #rx"-" (string-titlecase name) ""))) racket/base))] - will get the @scheme[racket/base] bindings that match the regexp, - and renamed to use ``camel case.''} + imports only bindings from @racketmodname[racket/base] that match the + pattern @scheme[#rx"^[a-z-]+$"], and it converts the names to ``camel case.''} @defform[(path-up rel-string ...)]{ -This specifies paths to module named by the @scheme[rel-string]s in a -similar way to using the @scheme[rel-string]s directly, except that if the -required module files are not found there, they are searched for in the parent -directory (in @filepath{../@scheme[_rel-string]}), and then in -the grand-parent directory, going all the way up to the root. (Note -that the usual caveats hold for a macro that depends on files that it -looks for to determine its expansion: the resulting path becomes part -of the compiled form.) +Specifies paths to modules named by the @racket[rel-string]s similar +to using the @racket[rel-string]s directly, except that if a required +module file is not found relative to the enclosing source, it is +searched for in the parent directory, and then in the grand-parent +directory, etc., all the way to the root directory. The discovered +path relative to the enclosing source becomes part of the expanded +form. This form is useful in setting up a ``project environment''. For example, you can write a @filepath{config.ss} file in the root directory of your project with: -@schememod[ +@racketmod[ racket/base (require racket/require-syntax (for-syntax "utils/in-here.ss")) ;; require form for my utilities @@ -1118,7 +1116,7 @@ directory of your project with: (define-require-syntax utils-in in-here-transformer) ] and in @filepath{utils/in-here.ss} in the root: -@schememod[ +@racketmod[ racket/base (require racket/runtime-path) (provide in-here-transformer) @@ -1130,15 +1128,15 @@ and in @filepath{utils/in-here.ss} in the root: (let ([path (build-path here (format "~a.ss" (syntax-e #'sym)))]) (datum->syntax stx `(file ,(path->string path)) stx))])) ] -Finally, you can use it via @scheme[path-up]: -@schemeblock[ +Finally, you can use it via @racket[path-up]: +@racketblock[ (require racket/require (path-up "config.ss") (utils-in foo))] -Note that the order of requires in this form is important, as each of +Note that the order of requires in this example is important, as each of the first two bind the identifier used in the following. -An alternative in this scenario is to use @scheme[path-up] directly to +An alternative in this scenario is to use @racket[path-up] directly to get to the utility module: -@schemeblock[ +@racketblock[ (require racket/require (path-up "utils/foo.ss"))] but then you need to be careful with subdirectories that are called @filepath{utils}, which will override the one in the project's root. @@ -1146,52 +1144,49 @@ In other words, the previous method requires a single unique name.} @; -------------------- -@subsection{Additional @scheme[provide] Forms} +@subsection{Additional @racket[provide] Forms} @note-lib-only[racket/provide] @defform[(matching-identifiers-out regexp provide-spec)]{ Like - @scheme[provide-spec], but including only exports of bindings with - an external name that matches @scheme[regexp]. The @scheme[regexp] + @racket[provide-spec], but including only exports of bindings with + an external name that matches @racket[regexp]. The @racket[regexp] must be a literal regular expression (see @secref["regexp"]).} -@defform[(filtered-out proc-expr provide-spec)]{ The - @scheme[proc-expr] should evaluate to a single-argument procedure, - which is applied on each of the names (as strings) that are to be - provided according to @scheme[provide-spec]. For each name, the - procedure should return either a string (possibly different if you - want it renamed), or @scheme[#f] to exclude the name. (Note that - @scheme[proc-expr] is a syntax-time expression.) +@defform[(filtered-out proc-expr provide-spec)]{ + + Analogous to @scheme[filtered-in], but for filtering and renaming + exports. For example, - @schemeblock[ + @racketblock[ (provide (filtered-out (lambda (name) (and (regexp-match? #rx"^[a-z-]+$" name) (regexp-replace #rx"-" (string-titlecase name) ""))) (all-defined-out)))] - will provide all defined bindings that match the regexp, and renamed - to use ``camel case''.} + exports only bindings that match the + pattern @scheme[#rx"^[a-z-]+$"], and it converts the names to ``camel case.''} @;------------------------------------------------------------------------ -@section[#:tag "quote"]{Literals: @scheme[quote] and @scheme[#%datum]} +@section[#:tag "quote"]{Literals: @racket[quote] and @racket[#%datum]} -Many forms are implicitly quoted (via @scheme[#%datum]) as literals. See +Many forms are implicitly quoted (via @racket[#%datum]) as literals. See @secref["expand-steps"] for more information. -@guideintro["quote"]{@scheme[quote]} +@guideintro["quote"]{@racket[quote]} @defform[(quote datum)]{ -Produces a constant value corresponding to @scheme[datum] (i.e., the +Produces a constant value corresponding to @racket[datum] (i.e., the representation of the program fragment) without its @tech{lexical information}, source location, etc. Quoted pairs, vectors, and boxes are immutable. @mz-examples[ -(eval:alts (#,(schemekeywordfont "quote") x) 'x) -(eval:alts (#,(schemekeywordfont "quote") (+ 1 2)) '(+ 1 2)) +(eval:alts (#,(racketkeywordfont "quote") x) 'x) +(eval:alts (#,(racketkeywordfont "quote") (+ 1 2)) '(+ 1 2)) (+ 1 2) ] @@ -1199,12 +1194,12 @@ are immutable. @defform[(#%datum . datum)]{ -Expands to @scheme[(#,(schemekeywordfont "quote") datum)], as long as -@scheme[datum] is not a keyword. If @scheme[datum] is a keyword, a +Expands to @racket[(#,(racketkeywordfont "quote") datum)], as long as +@racket[datum] is not a keyword. If @racket[datum] is a keyword, a syntax error is reported. See also @secref["expand-steps"] for information on how the expander -introduces @schemeidfont{#%datum} identifiers. +introduces @racketidfont{#%datum} identifiers. @mz-examples[ (#%datum . 10) @@ -1214,12 +1209,12 @@ introduces @schemeidfont{#%datum} identifiers. } @;------------------------------------------------------------------------ -@section[#:tag "#%expression"]{Expression Wrapper: @scheme[#%expression]} +@section[#:tag "#%expression"]{Expression Wrapper: @racket[#%expression]} @defform[(#%expression expr)]{ -Produces the same result as @scheme[expr]. The only use of -@scheme[#%expression] is to force the parsing of a form as an +Produces the same result as @racket[expr]. The only use of +@racket[#%expression] is to force the parsing of a form as an expression. @mz-examples[ @@ -1228,20 +1223,20 @@ expression. ]} @;------------------------------------------------------------------------ -@section[#:tag "#%top"]{Variable References and @scheme[#%top]} +@section[#:tag "#%top"]{Variable References and @racket[#%top]} @defform/none[id]{ -Refers to a module-level or local binding, when @scheme[id] is +Refers to a module-level or local binding, when @racket[id] is not bound as a transformer (see @secref["expansion"]). At run-time, 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 +When the expander encounters an @racket[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"]. +@racket[(@#,racketidfont{#%top} . id)] giving @racketidfont{#%top} +the lexical context of the @racket[id]; typically, that context refers +to @racket[#%top]. See also @secref["expand-steps"]. @examples[ (define x 10) @@ -1252,11 +1247,11 @@ x @defform[(#%top . id)]{ -Refers to a top-level definition that could bind @scheme[id], even if -@scheme[id] has a local binding in its context. Such references are -disallowed anywhere within a @scheme[module] form. See also +Refers to a top-level definition that could bind @racket[id], even if +@racket[id] has a local binding in its context. Such references are +disallowed anywhere within a @racket[module] form. See also @secref["expand-steps"] for information on how the expander -introduces @schemeidfont{#%top} identifiers. +introduces @racketidfont{#%top} identifiers. @examples[ (define x 12) @@ -1264,7 +1259,7 @@ introduces @schemeidfont{#%top} identifiers. ]} @;------------------------------------------------------------------------ -@section{Locations: @scheme[#%variable-reference]} +@section{Locations: @racket[#%variable-reference]} @defform*[#:literals (#%top) [(#%variable-reference id) @@ -1272,24 +1267,24 @@ introduces @schemeidfont{#%top} identifiers. (#%variable-reference)]]{ Produces an opaque @deftech{variable reference} value representing the -location of @scheme[id], which must be bound as a @tech{top-level -variable} or @tech{module-level variable}. If no @scheme[id] is +location of @racket[id], which must be bound as a @tech{top-level +variable} or @tech{module-level variable}. If no @racket[id] is supplied, the resulting value refers to an ``anonymous'' variable defined within the enclosing context (i.e., within the enclosing module, or at the top level if the form is not inside a module). A @tech{variable reference} can be used with -@scheme[variable-reference->empty-namespace], -@scheme[variable-reference->resolved-module-path], and -@scheme[variable-reference->top-level-namespace], but facilities like -@scheme[define-namespace-anchor] and -@scheme[namespace-anchor->namespace] wrap those to provide an clearer +@racket[variable-reference->empty-namespace], +@racket[variable-reference->resolved-module-path], and +@racket[variable-reference->top-level-namespace], but facilities like +@racket[define-namespace-anchor] and +@racket[namespace-anchor->namespace] wrap those to provide an clearer interface. A @tech{variable reference} is also useful to low-level extensions; see @other-manual['(lib "scribblings/inside/inside.scrbl")].} @;------------------------------------------------------------------------ -@section[#:tag "application"]{Procedure Applications and @scheme[#%app]} +@section[#:tag "application"]{Procedure Applications and @racket[#%app]} @section-index{evaluation order} @@ -1297,16 +1292,16 @@ extensions; see @other-manual['(lib @defform/none[(proc-expr arg ...)]{ -Applies a procedure, when @scheme[proc-expr] is not an +Applies a procedure, when @racket[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 +@racket[(@#,racketidfont{#%app} proc-expr arg ...)], giving +@racketidfont{#%app} the lexical context that is associated with the +original form (i.e., the pair that combines @racket[proc-expr] and its arguments). Typically, the lexical context of the pair indicates the -procedure-application @scheme[#%app] that is described next. See also +procedure-application @racket[#%app] that is described next. See also @secref["expand-steps"]. @mz-examples[ @@ -1316,37 +1311,37 @@ procedure-application @scheme[#%app] that is described next. See also @defform[(#%app proc-expr arg ...)]{ -Applies a procedure. Each @scheme[arg] is one of the following: +Applies a procedure. Each @racket[arg] is one of the following: @specsubform[arg-expr]{The resulting value is a non-keyword argument.} @specsubform[(code:line keyword arg-expr)]{The resulting value is a - keyword argument using @scheme[keyword]. Each - @scheme[keyword] in the application must be distinct.} + keyword argument using @racket[keyword]. Each + @racket[keyword] in the application must be distinct.} -The @scheme[proc-expr] and @scheme[_arg-expr]s are evaluated in order, -left to right. If the result of @scheme[proc-expr] is a procedure that -accepts as many arguments as non-@scheme[_keyword] -@scheme[_arg-expr]s, if it accepts arguments for all of the -@scheme[_keyword]s in the application, and if all required -keyword-based arguments are represented among the @scheme[_keyword]s +The @racket[proc-expr] and @racket[_arg-expr]s are evaluated in order, +left to right. If the result of @racket[proc-expr] is a procedure that +accepts as many arguments as non-@racket[_keyword] +@racket[_arg-expr]s, if it accepts arguments for all of the +@racket[_keyword]s in the application, and if all required +keyword-based arguments are represented among the @racket[_keyword]s in the application, then the procedure is called with the values of -the @scheme[arg-expr]s. Otherwise, the @exnraise[exn:fail:contract]. +the @racket[arg-expr]s. Otherwise, the @exnraise[exn:fail:contract]. The continuation of the procedure call is the same as the continuation of the application expression, so the results of the procedure are the results of the application expression. -The relative order of @scheme[_keyword]-based arguments matters only -for the order of @scheme[_arg-expr] evaluations; the arguments are +The relative order of @racket[_keyword]-based arguments matters only +for the order of @racket[_arg-expr] evaluations; the arguments are associated with argument variables in the applied procedure based on -the @scheme[_keyword]s, and not their positions. The other -@scheme[_arg-expr] values, in contrast, are associated with variables +the @racket[_keyword]s, and not their positions. The other +@racket[_arg-expr] values, in contrast, are associated with variables according to their order in the application form. See also @secref["expand-steps"] for information on how the -expander introduces @schemeidfont{#%app} identifiers. +expander introduces @racketidfont{#%app} identifiers. @mz-examples[ (#%app + 1 2) @@ -1357,11 +1352,11 @@ expander introduces @schemeidfont{#%app} identifiers. @defform*[[(#%plain-app proc-expr arg-expr ...) (#%plain-app)]]{ -Like @scheme[#%app], but without support for keyword arguments. -As a special case, @scheme[(#%plain-app)] produces @scheme['()].} +Like @racket[#%app], but without support for keyword arguments. +As a special case, @racket[(#%plain-app)] produces @racket['()].} @;------------------------------------------------------------------------ -@section[#:tag "lambda"]{Procedure Expressions: @scheme[lambda] and @scheme[case-lambda]} +@section[#:tag "lambda"]{Procedure Expressions: @racket[lambda] and @racket[case-lambda]} @guideintro["lambda"]{procedure expressions} @@ -1377,93 +1372,93 @@ As a special case, @scheme[(#%plain-app)] produces @scheme['()].} (code:line keyword [id default-expr])])] )]{ -Produces a procedure. The @scheme[kw-formals] determines the number of +Produces a procedure. The @racket[kw-formals] determines the number of arguments and which keyword arguments that the procedure accepts. -Considering only the first @scheme[arg] case, a simple -@scheme[kw-formals] has one of the following three forms: +Considering only the first @racket[arg] case, a simple +@racket[kw-formals] has one of the following three forms: @specsubform[(id ...)]{ The procedure accepts as many non-keyword - argument values as the number of @scheme[id]s. Each @scheme[id] + argument values as the number of @racket[id]s. Each @racket[id] is associated with an argument value by position.} @specsubform[(id ...+ . rest-id)]{ The procedure accepts any number of non-keyword arguments greater or equal to the number of - @scheme[id]s. When the procedure is applied, the @scheme[id]s + @racket[id]s. When the procedure is applied, the @racket[id]s are associated with argument values by position, and all leftover arguments are placed into a list that is associated to - @scheme[rest-id].} + @racket[rest-id].} @specsubform[rest-id]{ The procedure accepts any number of non-keyword arguments. All arguments are placed into a list that is - associated with @scheme[rest-id].} + associated with @racket[rest-id].} -More generally, an @scheme[arg] can include a keyword and/or default +More generally, an @racket[arg] can include a keyword and/or default value. Thus, the first two cases above are more completely specified as follows: -@specsubform[(arg ...)]{ Each @scheme[arg] has the following +@specsubform[(arg ...)]{ Each @racket[arg] has the following four forms: @specsubform[id]{Adds one to both the minimum and maximum number of non-keyword arguments accepted by the procedure. The - @scheme[id] is associated with an actual argument by + @racket[id] is associated with an actual argument by position.} @specsubform[[id default-expr]]{Adds one to the maximum number of non-keyword arguments accepted by the procedure. The - @scheme[id] is associated with an actual argument by position, - and if no such argument is provided, the @scheme[default-expr] - is evaluated to produce a value associated with @scheme[id]. - No @scheme[arg] with a @scheme[default-expr] can appear - before an @scheme[id] without a @scheme[default-expr] and - without a @scheme[keyword].} + @racket[id] is associated with an actual argument by position, + and if no such argument is provided, the @racket[default-expr] + is evaluated to produce a value associated with @racket[id]. + No @racket[arg] with a @racket[default-expr] can appear + before an @racket[id] without a @racket[default-expr] and + without a @racket[keyword].} @specsubform[(code:line keyword id)]{The procedure requires a - keyword-based argument using @scheme[keyword]. The @scheme[id] + keyword-based argument using @racket[keyword]. The @racket[id] is associated with a keyword-based actual argument using - @scheme[keyword].} + @racket[keyword].} @specsubform[(code:line keyword [id default-expr])]{The - procedure accepts a keyword-based using @scheme[keyword]. The - @scheme[id] is associated with a keyword-based actual argument - using @scheme[keyword], if supplied in an application; - otherwise, the @scheme[default-expr] is evaluated to obtain a - value to associate with @scheme[id].} + procedure accepts a keyword-based using @racket[keyword]. The + @racket[id] is associated with a keyword-based actual argument + using @racket[keyword], if supplied in an application; + otherwise, the @racket[default-expr] is evaluated to obtain a + value to associate with @racket[id].} - The position of a @scheme[_keyword] @scheme[arg] in - @scheme[kw-formals] does not matter, but each specified - @scheme[keyword] must be distinct.} + The position of a @racket[_keyword] @racket[arg] in + @racket[kw-formals] does not matter, but each specified + @racket[keyword] must be distinct.} @specsubform[(arg ...+ . rest-id)]{ Like the previous case, but the procedure accepts any number of non-keyword arguments beyond its minimum number of arguments. When more arguments are - provided than non-@scheme[_keyword] arguments among the - @scheme[arg]s, the extra arguments are placed into a - list that is associated to @scheme[rest-id].} + provided than non-@racket[_keyword] arguments among the + @racket[arg]s, the extra arguments are placed into a + list that is associated to @racket[rest-id].} -The @scheme[kw-formals] identifiers are bound in the -@scheme[body]s. When the procedure is applied, a new @tech{location} +The @racket[kw-formals] identifiers are bound in the +@racket[body]s. When the procedure is applied, a new @tech{location} is created for each identifier, and the location is filled with the associated argument value. The @tech{locations} are created and filled -in order, with @scheme[_default-expr]s evaluated as needed to fill +in order, with @racket[_default-expr]s evaluated as needed to fill locations. @margin-note{In other words, argument bindings with -default-value expressions are evaluated analogous to @scheme[let*].} +default-value expressions are evaluated analogous to @racket[let*].} -If any identifier appears in the @scheme[body]s that is not one of the -identifiers in @scheme[kw-formals], then it refers to the same -location that it would if it appeared in place of the @scheme[lambda] +If any identifier appears in the @racket[body]s that is not one of the +identifiers in @racket[kw-formals], then it refers to the same +location that it would if it appeared in place of the @racket[lambda] expression. (In other words, variable reference is lexically scoped.) -When multiple identifiers appear in a @scheme[kw-formals], they must -be distinct according to @scheme[bound-identifier=?]. +When multiple identifiers appear in a @racket[kw-formals], they must +be distinct according to @racket[bound-identifier=?]. -If the procedure produced by @scheme[lambda] is applied to fewer or +If the procedure produced by @racket[lambda] is applied to fewer or more by-position or by-keyword arguments than it accepts, to by-keyword arguments that it does not accept, or without required by-keyword arguments, then the @exnraise[exn:fail:contract]. -The last @scheme[body] expression is in tail position with respect to +The last @racket[body] expression is in tail position with respect to the procedure body. @mz-examples[ @@ -1475,17 +1470,17 @@ the procedure body. (f #:arg 2 1))) ] -When compiling a @scheme[lambda] or @scheme[case-lambda] expression, -Scheme looks for a @indexed-scheme['method-arity-error] property +When compiling a @racket[lambda] or @racket[case-lambda] expression, +Racket looks for a @indexed-racket['method-arity-error] property attached to the expression (see @secref["stxprops"]). If it is present with a true value, and if no case of the procedure accepts zero arguments, then the procedure is marked so that an -@scheme[exn:fail:contract:arity] exception involving the procedure +@racket[exn:fail:contract:arity] exception involving the procedure will hide the first argument, if one was provided. (Hiding the first argument is useful when the procedure implements a method, where the first argument is implicit in the original source). The property -affects only the format of @scheme[exn:fail:contract:arity] -exceptions, not the result of @scheme[procedure-arity].} +affects only the format of @racket[exn:fail:contract:arity] +exceptions, not the result of @racket[procedure-arity].} @defform/subs[(case-lambda [formals body ...+] ...) @@ -1493,17 +1488,17 @@ exceptions, not the result of @scheme[procedure-arity].} (id ...+ . rest-id) rest-id])]{ -Produces a procedure. Each @scheme[[forms body ...+]] -clause is analogous to a single @scheme[lambda] procedure; applying -the @scheme[case-lambda]-generated procedure is the same as applying a +Produces a procedure. Each @racket[[forms body ...+]] +clause is analogous to a single @racket[lambda] procedure; applying +the @racket[case-lambda]-generated procedure is the same as applying a procedure that corresponds to one of the clauses---the first procedure that accepts the given number of arguments. If no corresponding procedure accepts the given number of arguments, the @exnraise[exn:fail:contract]. -Note that a @scheme[case-lambda] clause supports only -@scheme[formals], not the more general @scheme[_kw-formals] of -@scheme[lambda]. That is, @scheme[case-lambda] does not directly +Note that a @racket[case-lambda] clause supports only +@racket[formals], not the more general @racket[_kw-formals] of +@racket[lambda]. That is, @racket[case-lambda] does not directly support keyword and optional arguments. @mz-examples[ @@ -1519,23 +1514,23 @@ support keyword and optional arguments. ]} @defform[(#%plain-lambda formals body ...+)]{ -Like @scheme[lambda], but without support for keyword or optional arguments. +Like @racket[lambda], but without support for keyword or optional arguments. } @;------------------------------------------------------------------------ -@section[#:tag "let"]{Local Binding: @scheme[let], @scheme[let*], @scheme[letrec], ...} +@section[#:tag "let"]{Local Binding: @racket[let], @racket[let*], @racket[letrec], ...} @guideintro["let"]{local binding} @defform*[[(let ([id val-expr] ...) body ...+) (let proc-id ([id init-expr] ...) body ...+)]]{ -The first form evaluates the @scheme[val-expr]s left-to-right, creates -a new location for each @scheme[id], and places the values into the -locations. It then evaluates the @scheme[body]s, in which the -@scheme[id]s are bound. The last @scheme[body] expression is in -tail position with respect to the @scheme[let] form. The @scheme[id]s -must be distinct according to @scheme[bound-identifier=?]. +The first form evaluates the @racket[val-expr]s left-to-right, creates +a new location for each @racket[id], and places the values into the +locations. It then evaluates the @racket[body]s, in which the +@racket[id]s are bound. The last @racket[body] expression is in +tail position with respect to the @racket[let] form. The @racket[id]s +must be distinct according to @racket[bound-identifier=?]. @mz-examples[ (let ([x 5]) x) @@ -1545,10 +1540,10 @@ must be distinct according to @scheme[bound-identifier=?]. (list y x))) ] -The second form evaluates the @scheme[init-expr]s; the resulting +The second form evaluates the @racket[init-expr]s; the resulting values become arguments in an application of a procedure -@scheme[(lambda (id ...) body ...+)], where @scheme[proc-id] is bound -within the @scheme[body]s to the procedure itself.} +@racket[(lambda (id ...) body ...+)], where @racket[proc-id] is bound +within the @racket[body]s to the procedure itself.} @mz-examples[ (let fac ([n 10]) @@ -1559,10 +1554,10 @@ within the @scheme[body]s to the procedure itself.} @defform[(let* ([id val-expr] ...) body ...+)]{ -Similar to @scheme[let], but evaluates the @scheme[val-expr]s one by -one, creating a location for each @scheme[id] as soon as the value is -available. The @scheme[id]s are bound in the remaining @scheme[val-expr]s -as well as the @scheme[body]s, and the @scheme[id]s need not be +Similar to @racket[let], but evaluates the @racket[val-expr]s one by +one, creating a location for each @racket[id] as soon as the value is +available. The @racket[id]s are bound in the remaining @racket[val-expr]s +as well as the @racket[body]s, and the @racket[id]s need not be distinct; later bindings shadow earlier bindings. @mz-examples[ @@ -1573,11 +1568,11 @@ distinct; later bindings shadow earlier bindings. @defform[(letrec ([id val-expr] ...) body ...+)]{ -Similar to @scheme[let], but the locations for all @scheme[id]s are +Similar to @racket[let], but the locations for all @racket[id]s are created first and filled with @|undefined-const|, and all -@scheme[id]s are bound in all @scheme[val-expr]s as well as the -@scheme[body]s. The @scheme[id]s must be distinct according to -@scheme[bound-identifier=?]. +@racket[id]s are bound in all @racket[val-expr]s as well as the +@racket[body]s. The @racket[id]s must be distinct according to +@racket[bound-identifier=?]. @mz-examples[ (letrec ([is-even? (lambda (n) @@ -1590,10 +1585,10 @@ created first and filled with @|undefined-const|, and all ]} @defform[(let-values ([(id ...) val-expr] ...) body ...+)]{ Like -@scheme[let], except that each @scheme[val-expr] must produce as many -values as corresponding @scheme[id]s, otherwise the +@racket[let], except that each @racket[val-expr] must produce as many +values as corresponding @racket[id]s, otherwise the @exnraise[exn:fail:contract]. A separate location is created for each -@scheme[id], all of which are bound in the @scheme[body]s. +@racket[id], all of which are bound in the @racket[body]s. @mz-examples[ (let-values ([(x y) (quotient/remainder 10 3)]) @@ -1601,10 +1596,10 @@ values as corresponding @scheme[id]s, otherwise the ]} @defform[(let*-values ([(id ...) val-expr] ...) body ...+)]{ Like -@scheme[let*], except that each @scheme[val-expr] must produce as many -values as corresponding @scheme[id]s. A separate location is created -for each @scheme[id], all of which are bound in the later -@scheme[val-expr]s and in the @scheme[body]s. +@racket[let*], except that each @racket[val-expr] must produce as many +values as corresponding @racket[id]s. A separate location is created +for each @racket[id], all of which are bound in the later +@racket[val-expr]s and in the @racket[body]s. @mz-examples[ (let*-values ([(x y) (quotient/remainder 10 3)] @@ -1613,11 +1608,11 @@ for each @scheme[id], all of which are bound in the later ]} @defform[(letrec-values ([(id ...) val-expr] ...) body ...+)]{ Like -@scheme[letrec], except that each @scheme[val-expr] must produce as -many values as corresponding @scheme[id]s. A separate location is -created for each @scheme[id], all of which are initialized to -@|undefined-const| and bound in all @scheme[val-expr]s -and in the @scheme[body]s. +@racket[letrec], except that each @racket[val-expr] must produce as +many values as corresponding @racket[id]s. A separate location is +created for each @racket[id], all of which are initialized to +@|undefined-const| and bound in all @racket[val-expr]s +and in the @racket[body]s. @mz-examples[ (letrec-values ([(is-even? is-odd?) @@ -1633,96 +1628,96 @@ and in the @scheme[body]s. @defform[(let-syntax ([id trans-expr] ...) body ...+)]{ -@margin-note/ref{See also @scheme[splicing-let-syntax].} +@margin-note/ref{See also @racket[splicing-let-syntax].} Creates a @tech{transformer binding} (see -@secref["transformer-model"]) of each @scheme[id] with the value of -@scheme[trans-expr], which is an expression at @tech{phase level} 1 +@secref["transformer-model"]) of each @racket[id] with the value of +@racket[trans-expr], which is an expression at @tech{phase level} 1 relative to the surrounding context. (See @secref["id-model"] for information on @tech{phase levels}.) -The evaluation of each @scheme[trans-expr] is @scheme[parameterize]d -to set @scheme[current-namespace] to a @tech{namespace} that shares +The evaluation of each @racket[trans-expr] is @racket[parameterize]d +to set @racket[current-namespace] to a @tech{namespace} that shares @tech{bindings} and @tech{variables} with the namespace being used to -expand the @scheme[let-syntax] form, except that its @tech{base phase} +expand the @racket[let-syntax] form, except that its @tech{base phase} is one greater. -Each @scheme[id] is bound in the @scheme[body]s, and not in other -@scheme[trans-expr]s.} +Each @racket[id] is bound in the @racket[body]s, and not in other +@racket[trans-expr]s.} @defform[(letrec-syntax ([id trans-expr] ...) body ...+)]{ -@margin-note/ref{See also @scheme[splicing-letrec-syntax].} +@margin-note/ref{See also @racket[splicing-letrec-syntax].} -Like @scheme[let-syntax], except that each @scheme[id] is also bound -within all @scheme[trans-expr]s.} +Like @racket[let-syntax], except that each @racket[id] is also bound +within all @racket[trans-expr]s.} @defform[(let-syntaxes ([(id ...) trans-expr] ...) body ...+)]{ -@margin-note/ref{See also @scheme[splicing-let-syntaxes].} +@margin-note/ref{See also @racket[splicing-let-syntaxes].} -Like @scheme[let-syntax], but each @scheme[trans-expr] must produce as -many values as corresponding @scheme[id]s, each of which is bound to +Like @racket[let-syntax], but each @racket[trans-expr] must produce as +many values as corresponding @racket[id]s, each of which is bound to the corresponding value.} @defform[(letrec-syntaxes ([(id ...) trans-expr] ...) body ...+)]{ -@margin-note/ref{See also @scheme[splicing-letrec-syntaxes].} +@margin-note/ref{See also @racket[splicing-letrec-syntaxes].} -Like @scheme[let-syntax], except that each @scheme[id] is also bound -within all @scheme[trans-expr]s.} +Like @racket[let-syntax], except that each @racket[id] is also bound +within all @racket[trans-expr]s.} @defform[(letrec-syntaxes+values ([(trans-id ...) trans-expr] ...) ([(val-id ...) val-expr] ...) body ...+)]{ -Combines @scheme[letrec-syntaxes] with @scheme[letrec-values]: each -@scheme[trans-id] and @scheme[val-id] is bound in all -@scheme[trans-expr]s and @scheme[val-expr]s. +Combines @racket[letrec-syntaxes] with @racket[letrec-values]: each +@racket[trans-id] and @racket[val-id] is bound in all +@racket[trans-expr]s and @racket[val-expr]s. -The @scheme[letrec-syntaxes+values] form is the core form for local -compile-time bindings, since forms like @scheme[letrec-syntax] and -internal @scheme[define-syntax] expand to it. In a fully expanded -expression (see @secref["fully-expanded"]), the @scheme[trans-id] -bindings are discarded and the form reduces to @scheme[letrec], but -@scheme[letrec-syntaxes+values] can appear in the result of -@scheme[local-expand] with an empty stop list. +The @racket[letrec-syntaxes+values] form is the core form for local +compile-time bindings, since forms like @racket[letrec-syntax] and +internal @racket[define-syntax] expand to it. In a fully expanded +expression (see @secref["fully-expanded"]), the @racket[trans-id] +bindings are discarded and the form reduces to @racket[letrec], but +@racket[letrec-syntaxes+values] can appear in the result of +@racket[local-expand] with an empty stop list. -See also @scheme[local], which supports local bindings with -@scheme[define], @scheme[define-syntax], and more.} +See also @racket[local], which supports local bindings with +@racket[define], @racket[define-syntax], and more.} @;------------------------------------------------------------------------ -@section[#:tag "local"]{Local Definitions: @scheme[local]} +@section[#:tag "local"]{Local Definitions: @racket[local]} @note-lib[racket/local] @defform[(local [definition ...] body ...+)]{ -Like @scheme[letrec], except that the bindings are expressed in the +Like @racket[letrec], except that the bindings are expressed in the same way as in the top-level or in a module body: using -@scheme[define], @scheme[define-values], @scheme[define-syntax], -@scheme[define-struct], etc. Definitions are distinguished from -non-definitions by partially expanding @scheme[definition] forms (see +@racket[define], @racket[define-values], @racket[define-syntax], +@racket[struct], etc. Definitions are distinguished from +non-definitions by partially expanding @racket[definition] forms (see @secref["partial-expansion"]). As in the top-level or in a module -body, a @scheme[begin]-wrapped sequence is spliced into the sequence -of @scheme[definition]s.} +body, a @racket[begin]-wrapped sequence is spliced into the sequence +of @racket[definition]s.} @;------------------------------------------------------------------------ @include-section["shared.scrbl"] @;------------------------------------------------------------------------ -@section[#:tag "if"]{Conditionals: @scheme[if], @scheme[cond], @scheme[and], and @scheme[or]} +@section[#:tag "if"]{Conditionals: @racket[if], @racket[cond], @racket[and], and @racket[or]} @guideintro["conditionals"]{conditionals} @defform[(if test-expr then-expr else-expr)]{ -Evaluates @scheme[test-expr]. If it produces any value other than -@scheme[#f], then @scheme[then-expr] is evaluated, and its results are -the result for the @scheme[if] form. Otherwise, @scheme[else-expr] is -evaluated, and its results are the result for the @scheme[if] -form. The @scheme[then-expr] and @scheme[else-expr] are in tail -position with respect to the @scheme[if] form. +Evaluates @racket[test-expr]. If it produces any value other than +@racket[#f], then @racket[then-expr] is evaluated, and its results are +the result for the @racket[if] form. Otherwise, @racket[else-expr] is +evaluated, and its results are the result for the @racket[if] +form. The @racket[then-expr] and @racket[else-expr] are in tail +position with respect to the @racket[if] form. @mz-examples[ (if (positive? -5) (error "doesn't get here") 2) @@ -1737,42 +1732,42 @@ position with respect to the @scheme[if] form. [test-expr => proc-expr] [test-expr]])]{ -@guideintro["cond"]{@scheme[cond]} +@guideintro["cond"]{@racket[cond]} -A @scheme[cond-clause] that starts with @scheme[else] must be the last -@scheme[cond-clause]. +A @racket[cond-clause] that starts with @racket[else] must be the last +@racket[cond-clause]. -If no @scheme[cond-clause]s are present, the result is @|void-const|. +If no @racket[cond-clause]s are present, the result is @|void-const|. -If only a @scheme[[else then-expr ...+]] is present, then the -@scheme[then-expr]s are evaluated. The results from all but the last -@scheme[then-expr] are ignored. The results of the last -@scheme[then-expr], which is in tail position with respect to the -@scheme[cond] form, are the results for the whole @scheme[cond] +If only a @racket[[else then-expr ...+]] is present, then the +@racket[then-expr]s are evaluated. The results from all but the last +@racket[then-expr] are ignored. The results of the last +@racket[then-expr], which is in tail position with respect to the +@racket[cond] form, are the results for the whole @racket[cond] form. -Otherwise, the first @scheme[test-expr] is evaluated. If it produces -@scheme[#f], then the result is the same as a @scheme[cond] form with -the remaining @scheme[cond-clause]s, in tail position with respect to -the original @scheme[cond] form. Otherwise, evaluation depends on the -form of the @scheme[cond-clause]: +Otherwise, the first @racket[test-expr] is evaluated. If it produces +@racket[#f], then the result is the same as a @racket[cond] form with +the remaining @racket[cond-clause]s, in tail position with respect to +the original @racket[cond] form. Otherwise, evaluation depends on the +form of the @racket[cond-clause]: -@specsubform[[test-expr then-expr ...+]]{The @scheme[then-expr]s are +@specsubform[[test-expr then-expr ...+]]{The @racket[then-expr]s are evaluated in order, and the results from all but the last -@scheme[then-expr] are ignored. The results of the last -@scheme[then-expr], which is in tail position with respect to the -@scheme[cond] form, provides the result for the whole @scheme[cond] +@racket[then-expr] are ignored. The results of the last +@racket[then-expr], which is in tail position with respect to the +@racket[cond] form, provides the result for the whole @racket[cond] form.} -@specsubform[#:literals (=>) [test-expr => proc-expr]]{The @scheme[proc-expr] is +@specsubform[#:literals (=>) [test-expr => proc-expr]]{The @racket[proc-expr] is evaluated, and it must produce a procedure that accepts on argument, otherwise the @exnraise[exn:fail:contract]. The procedure is applied -to the result of @scheme[test-expr] in tail position with respect to -the @scheme[cond] expression.} +to the result of @racket[test-expr] in tail position with respect to +the @racket[cond] expression.} -@specsubform[[test-expr]]{The result of the @scheme[test-expr] is -returned as the result of the @scheme[cond] form. The -@scheme[test-expr] is not in tail position.} +@specsubform[[test-expr]]{The result of the @racket[test-expr] is +returned as the result of the @racket[cond] form. The +@racket[test-expr] is not in tail position.} @mz-examples[ (cond) @@ -1791,31 +1786,31 @@ returned as the result of the @scheme[cond] form. The @defidform[else]{ -Recognized specially within forms like @scheme[cond]. An -@scheme[else] form as an expression is a syntax error.} +Recognized specially within forms like @racket[cond]. An +@racket[else] form as an expression is a syntax error.} @defidform[=>]{ -Recognized specially within forms like @scheme[cond]. A -@scheme[=>] form as an expression is a syntax error.} +Recognized specially within forms like @racket[cond]. A +@racket[=>] form as an expression is a syntax error.} @defform[(and expr ...)]{ -@guideintro["and+or"]{@scheme[and]} +@guideintro["and+or"]{@racket[and]} -If no @scheme[expr]s are provided, then result is @scheme[#t]. +If no @racket[expr]s are provided, then result is @racket[#t]. -If a single @scheme[expr] is provided, then it is in tail position, so -the results of the @scheme[and] expression are the results of the -@scheme[expr]. +If a single @racket[expr] is provided, then it is in tail position, so +the results of the @racket[and] expression are the results of the +@racket[expr]. -Otherwise, the first @scheme[expr] is evaluated. If it produces -@scheme[#f], the result of the @scheme[and] expression is -@scheme[#f]. Otherwise, the result is the same as an @scheme[and] -expression with the remaining @scheme[expr]s in tail position with -respect to the original @scheme[and] form. +Otherwise, the first @racket[expr] is evaluated. If it produces +@racket[#f], the result of the @racket[and] expression is +@racket[#f]. Otherwise, the result is the same as an @racket[and] +expression with the remaining @racket[expr]s in tail position with +respect to the original @racket[and] form. @mz-examples[ (and) @@ -1827,19 +1822,19 @@ respect to the original @scheme[and] form. @defform[(or expr ...)]{ -@guideintro["and+or"]{@scheme[or]} +@guideintro["and+or"]{@racket[or]} -If no @scheme[expr]s are provided, then result is @scheme[#f]. +If no @racket[expr]s are provided, then result is @racket[#f]. -If a single @scheme[expr] is provided, then it is in tail position, so -the results of the @scheme[and] expression are the results of the -@scheme[expr]. +If a single @racket[expr] is provided, then it is in tail position, so +the results of the @racket[and] expression are the results of the +@racket[expr]. -Otherwise, the first @scheme[expr] is evaluated. If it produces a -value other than @scheme[#f], that result is the result of the -@scheme[or] expression. Otherwise, the result is the same as an -@scheme[or] expression with the remaining @scheme[expr]s in tail -position with respect to the original @scheme[or] form. +Otherwise, the first @racket[expr] is evaluated. If it produces a +value other than @racket[#f], that result is the result of the +@racket[or] expression. Otherwise, the result is the same as an +@racket[or] expression with the remaining @racket[expr]s in tail +position with respect to the original @racket[or] form. @mz-examples[ (or) @@ -1850,27 +1845,27 @@ position with respect to the original @scheme[or] form. ]} @;------------------------------------------------------------------------ -@section[#:tag "case"]{Dispatch: @scheme[case]} +@section[#:tag "case"]{Dispatch: @racket[case]} @defform/subs[#:literals (else) (case val-expr case-clause ...) ([case-clause [(datum ...) then-expr ...+] [else then-expr ...+]])]{ -Evaluates @scheme[val-expr] and uses the result to select a -@scheme[case-clause]. The selected clause is the first one with a -@scheme[datum] whose @scheme[quote]d form is @scheme[eqv?] to the -result of @scheme[val-expr]. If no such @scheme[datum] is present, the -@scheme[else] @scheme[case-clause] is selected; if no @scheme[else] -@scheme[case-clause] is present, either, then the result of the -@scheme[case] form is @|void-const|. +Evaluates @racket[val-expr] and uses the result to select a +@racket[case-clause]. The selected clause is the first one with a +@racket[datum] whose @racket[quote]d form is @racket[eqv?] to the +result of @racket[val-expr]. If no such @racket[datum] is present, the +@racket[else] @racket[case-clause] is selected; if no @racket[else] +@racket[case-clause] is present, either, then the result of the +@racket[case] form is @|void-const|. -For the selected @scheme[case-clause], the results of the last -@scheme[then-expr], which is in tail position with respect to the -@scheme[case] form, are the results for the whole @scheme[case] form. +For the selected @racket[case-clause], the results of the last +@racket[then-expr], which is in tail position with respect to the +@racket[case] form, are the results for the whole @racket[case] form. -A @scheme[case-clause] that starts with @scheme[else] must be the last -@scheme[case-clause]. +A @racket[case-clause] that starts with @racket[else] must be the last +@racket[case-clause]. @mz-examples[ (case (+ 7 5) @@ -1892,7 +1887,7 @@ A @scheme[case-clause] that starts with @scheme[else] must be the last ]} @;------------------------------------------------------------------------ -@section[#:tag "define"]{Definitions: @scheme[define], @scheme[define-syntax], ...} +@section[#:tag "define"]{Definitions: @racket[define], @racket[define-syntax], ...} @guideintro["define"]{definitions} @@ -1901,27 +1896,27 @@ 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 ... @#,racketparenfont{.} rest-id)] [arg arg-id [arg-id default-expr] (code:line keyword arg-id) (code:line keyword [arg-id default-expr])])]{ -The first form @tech{bind}s @scheme[id] to the result of -@scheme[expr], and the second form @tech{bind}s @scheme[id] to a -procedure. In the second case, the generation procedure is -@scheme[(#,cvt (head args) body ...+)], using the @|cvt| meta-function +The first form @tech{bind}s @racket[id] to the result of +@racket[expr], and the second form @tech{bind}s @racket[id] to a +procedure. In the second case, the generated procedure is +@racket[(#,cvt (head args) body ...+)], using the @|cvt| meta-function defined as follows: -@schemeblock[ +@racketblock[ (#,cvt (id . _kw-formals) . _datum) = (lambda _kw-formals . _datum) (#,cvt (head . _kw-formals) . _datum) = (lambda _kw-formals expr) @#,elem{if} (#,cvt head . _datum) = expr ] -At the top level, the top-level binding @scheme[id] is created after -evaluating @scheme[expr], if it does not exist already, and the -top-level mapping of @scheme[id] (in the @techlink{namespace} linked +At the top level, the top-level binding @racket[id] is created after +evaluating @racket[expr], if it does not exist already, and the +top-level mapping of @racket[id] (in the @techlink{namespace} linked with the compiled definition) is set to the binding at the same time. @defexamples[ @@ -1944,14 +1939,14 @@ x @defform[(define-values (id ...) expr)]{ -Evaluates the @scheme[expr], and @tech{bind}s the results to the -@scheme[id]s, in order, if the number of results matches the number of -@scheme[id]s; if @scheme[expr] produces a different number of results, +Evaluates the @racket[expr], and @tech{bind}s the results to the +@racket[id]s, in order, if the number of results matches the number of +@racket[id]s; if @racket[expr] produces a different number of results, the @exnraise[exn:fail:contract]. -At the top level, the top-level binding for each @scheme[id] is -created after evaluating @scheme[expr], if it does not exist already, -and the top-level mapping of each @scheme[id] (in the +At the top level, the top-level binding for each @racket[id] is +created after evaluating @racket[expr], if it does not exist already, +and the top-level mapping of each @racket[id] (in the @techlink{namespace} linked with the compiled definition) is set to the binding at the same time. @@ -1967,16 +1962,16 @@ z (define-syntax (head args) body ...+)]]{ The first form creates a @tech{transformer binding} (see -@secref["transformer-model"]) of @scheme[id] with the value of -@scheme[expr], which is an expression at @tech{phase level} 1 relative +@secref["transformer-model"]) of @racket[id] with the value of +@racket[expr], which is an expression at @tech{phase level} 1 relative to the surrounding context. (See @secref["id-model"] for information -on @tech{phase levels}.) Evaluation of @scheme[expr] side is -@scheme[parameterize]d to set @scheme[current-namespace] as in -@scheme[let-syntax]. +on @tech{phase levels}.) Evaluation of @racket[expr] side is +@racket[parameterize]d to set @racket[current-namespace] as in +@racket[let-syntax]. -The second form is a shorthand the same as for @scheme[define]; it -expands to a definition of the first form where the @scheme[expr] is a -@scheme[lambda] form.} +The second form is a shorthand the same as for @racket[define]; it +expands to a definition of the first form where the @racket[expr] is a +@racket[lambda] form.} @defexamples[#:eval (syntax-eval) (define-syntax foo @@ -1996,14 +1991,14 @@ expands to a definition of the first form where the @scheme[expr] is a @defform[(define-syntaxes (id ...) expr)]{ -Like @scheme[define-syntax], but creates a @tech{transformer binding} -for each @scheme[id]. The @scheme[expr] should produce as many values -as @scheme[id]s, and each value is bound to the corresponding -@scheme[id]. +Like @racket[define-syntax], but creates a @tech{transformer binding} +for each @racket[id]. The @racket[expr] should produce as many values +as @racket[id]s, and each value is bound to the corresponding +@racket[id]. -When @scheme[expr] produces zero values for a top-level -@scheme[define-syntaxes] (i.e., not in a module or internal-definition -position), then the @scheme[id]s are effectively declared without +When @racket[expr] produces zero values for a top-level +@racket[define-syntaxes] (i.e., not in a module or internal-definition +position), then the @racket[id]s are effectively declared without binding; see @secref["macro-introduced-bindings"]. @defexamples[#:eval (syntax-eval) @@ -2028,12 +2023,12 @@ binding; see @secref["macro-introduced-bindings"]. @defform*[[(define-for-syntax id expr) (define-for-syntax (head args) body ...+)]]{ -Like @scheme[define], except that the binding is at @tech{phase level} +Like @racket[define], except that the binding is at @tech{phase level} 1 instead of @tech{phase level} 0 relative to its context. The expression for the binding is also at @tech{phase level} 1. (See @secref["id-model"] for information on @tech{phase levels}.) -Evaluation of @scheme[expr] side is @scheme[parameterize]d to set -@scheme[current-namespace] as in @scheme[let-syntax].} +Evaluation of @racket[expr] side is @racket[parameterize]d to set +@racket[current-namespace] as in @racket[let-syntax].} @defexamples[#:eval (syntax-eval) (define-for-syntax helper 2) @@ -2057,8 +2052,8 @@ helper @defform[(define-values-for-syntax (id ...) expr)]{ -Like @scheme[define-for-syntax], but @scheme[expr] must produce as -many values as supplied @scheme[id]s, and all of the @scheme[id]s are +Like @racket[define-for-syntax], but @racket[expr] must produce as +many values as supplied @racket[id]s, and all of the @racket[id]s are bound (at @tech{phase level} 1).} @defexamples[#:eval (syntax-eval) @@ -2071,66 +2066,66 @@ bound (at @tech{phase level} 1).} @; ---------------------------------------------------------------------- -@subsection[#:tag "require-syntax"]{@scheme[require] Macros} +@subsection[#:tag "require-syntax"]{@racket[require] Macros} @note-lib-only[racket/require-syntax] @defform*[[(define-require-syntax id expr) (define-require-syntax (id args ...) body ...+)]]{ -The first form is like @scheme[define-syntax], but for a -@scheme[require] sub-form. The @scheme[proc-expr] must produce a +The first form is like @racket[define-syntax], but for a +@racket[require] sub-form. The @racket[proc-expr] must produce a procedure that accepts and returns a syntax object representing a -@scheme[require] sub-form. +@racket[require] sub-form. -This form expands to @scheme[define-syntax] with a use of -@scheme[make-require-transformer]; see @secref["require-trans"] for +This form expands to @racket[define-syntax] with a use of +@racket[make-require-transformer]; see @secref["require-trans"] for more information. -The second form is a shorthand the same as for @scheme[define-syntax]; it -expands to a definition of the first form where the @scheme[expr] is a -@scheme[lambda] form.} +The second form is a shorthand the same as for @racket[define-syntax]; it +expands to a definition of the first form where the @racket[expr] is a +@racket[lambda] form.} @; ---------------------------------------------------------------------- -@subsection[#:tag "provide-syntax"]{@scheme[provide] Macros} +@subsection[#:tag "provide-syntax"]{@racket[provide] Macros} @note-lib-only[racket/provide-syntax] @defform*[[(define-provide-syntax id expr) (define-provide-syntax (id args ...) body ...+)]]{ -The first form is like @scheme[define-syntax], but for a -@scheme[provide] sub-form. The @scheme[proc-expr] must produce a +The first form is like @racket[define-syntax], but for a +@racket[provide] sub-form. The @racket[proc-expr] must produce a procedure that accepts and returns a syntax object representing a -@scheme[provide] sub-form. +@racket[provide] sub-form. -This form expands to @scheme[define-syntax] with a use of -@scheme[make-provide-transformer]; see @secref["provide-trans"] for +This form expands to @racket[define-syntax] with a use of +@racket[make-provide-transformer]; see @secref["provide-trans"] for more information. -The second form is a shorthand the same as for @scheme[define-syntax]; it -expands to a definition of the first form where the @scheme[expr] is a -@scheme[lambda] form.} +The second form is a shorthand the same as for @racket[define-syntax]; it +expands to a definition of the first form where the @racket[expr] is a +@racket[lambda] form.} @;------------------------------------------------------------------------ -@section[#:tag "begin"]{Sequencing: @scheme[begin], @scheme[begin0], and @scheme[begin-for-syntax]} +@section[#:tag "begin"]{Sequencing: @racket[begin], @racket[begin0], and @racket[begin-for-syntax]} -@guideintro["begin"]{@scheme[begin] and @scheme[begin0]} +@guideintro["begin"]{@racket[begin] and @racket[begin0]} @defform*[[(begin form ...) (begin expr ...+)]]{ -The first form applies when @scheme[begin] appears at the top level, +The first form applies when @racket[begin] appears at the top level, at module level, or in an internal-definition position (before any expression in the internal-definition sequence). In that case, the -@scheme[begin] form is equivalent to splicing the @scheme[form]s into +@racket[begin] form is equivalent to splicing the @racket[form]s into the enclosing context. -The second form applies for @scheme[begin] in an expression position. -In that case, the @scheme[expr]s are evaluated in order, and the -results are ignored for all but the last @scheme[expr]. The last -@scheme[expr] is in tail position with respect to the @scheme[begin] +The second form applies for @racket[begin] in an expression position. +In that case, the @racket[expr]s are evaluated in order, and the +results are ignored for all but the last @racket[expr]. The last +@racket[expr] is in tail position with respect to the @racket[begin] form. @examples[ @@ -2148,10 +2143,10 @@ form. @defform[(begin0 expr body ...+)]{ -Evaluates the @scheme[expr], then evaluates the @scheme[body]s, -ignoring the @scheme[body] results. The results of the @scheme[expr] -are the results of the @scheme[begin0] form, but the @scheme[expr] is -in tail position only if no @scheme[body]s are present. +Evaluates the @racket[expr], then evaluates the @racket[body]s, +ignoring the @racket[body] results. The results of the @racket[expr] +are the results of the @racket[begin0] form, but the @racket[expr] is +in tail position only if no @racket[body]s are present. @mz-examples[ (begin0 @@ -2162,20 +2157,20 @@ in tail position only if no @scheme[body]s are present. @defform[(begin-for-syntax form ...)]{ Allowed only in a @tech{top-level context} or @tech{module context}. -Each @scheme[form] is partially expanded (see +Each @racket[form] is partially expanded (see @secref["partial-expansion"]) to determine one of the following classifications: @itemize[ - @item{@scheme[define] or @scheme[define-values] form: converted to - a @scheme[define-values-for-syntax] form.} + @item{@racket[define] or @racket[define-values] form: converted to + a @racket[define-values-for-syntax] form.} - @item{@scheme[require] form: content is wrapped with - @scheme[for-syntax].} + @item{@racket[require] form: content is wrapped with + @racket[for-syntax].} - @item{expression form @scheme[_expr]: converted to - @scheme[(define-values-for-syntax () (begin _expr (values)))], which + @item{expression form @racket[_expr]: converted to + @racket[(define-values-for-syntax () (begin _expr (values)))], which effectively evaluates the expression at expansion time and, in the case of a @tech{module context}, preserves the expression for future @tech{visit}s of the module.} @@ -2185,17 +2180,17 @@ classifications: } @;------------------------------------------------------------------------ -@section[#:tag "when+unless"]{Guarded Evaluation: @scheme[when] and @scheme[unless]} +@section[#:tag "when+unless"]{Guarded Evaluation: @racket[when] and @racket[unless]} -@guideintro["when+unless"]{@scheme[when] and @scheme[unless]} +@guideintro["when+unless"]{@racket[when] and @racket[unless]} @defform[(when test-expr expr ...)]{ -Evaluates the @scheme[text-expr]. If the result is @scheme[#f], then -the result of the @scheme[when] expression is -@|void-const|. Otherwise, the @scheme[expr]s are evaluated, and the -last @scheme[expr] is in tail position with respect to the -@scheme[when] form. +Evaluates @racket[test-expr]. If the result is @racket[#f], then +the result of the @racket[when] expression is +@|void-const|. Otherwise, the @racket[expr]s are evaluated, and the +last @racket[expr] is in tail position with respect to the +@racket[when] form. @mz-examples[ (when (positive? -5) @@ -2207,7 +2202,7 @@ last @scheme[expr] is in tail position with respect to the @defform[(unless test-expr expr ...)]{ -Equivalent to @scheme[(when (not test-expr) expr ...)]. +Equivalent to @racket[(when (not test-expr) expr ...)]. @mz-examples[ (unless (positive? 5) @@ -2218,34 +2213,34 @@ Equivalent to @scheme[(when (not test-expr) expr ...)]. ]} @;------------------------------------------------------------------------ -@section[#:tag "set!"]{Assignment: @scheme[set!] and @scheme[set!-values]} +@section[#:tag "set!"]{Assignment: @racket[set!] and @racket[set!-values]} -@guideintro["set!"]{@scheme[set!]} +@guideintro["set!"]{@racket[set!]} @defform[(set! id expr)]{ -If @scheme[id] has a @tech{transformer binding} to an @tech{assignment -transformer}, as produced by @scheme[make-set!-transformer] or as an -instance of a structure type with the @scheme[prop:set!-transformer] +If @racket[id] has a @tech{transformer binding} to an @tech{assignment +transformer}, as produced by @racket[make-set!-transformer] or as an +instance of a structure type with the @racket[prop:set!-transformer] property, then this form is expanded by calling the assignment -transformer with the full expressions. If @scheme[id] has a +transformer with the full expressions. If @racket[id] has a @tech{transformer binding} to a @tech{rename transformer} as produced -by @scheme[make-rename-transformer] or as an instance of a structure -type with the @scheme[prop:rename-transformer] property, then this -form is expanded by replacing @scheme[id] with the target identifier -(e.g., the one provided to @scheme[make-rename-transformer]). If a -transformer binding has both @scheme[prop:set!-transformer] ad -@scheme[prop:rename-transformer] properties, the latter takes +by @racket[make-rename-transformer] or as an instance of a structure +type with the @racket[prop:rename-transformer] property, then this +form is expanded by replacing @racket[id] with the target identifier +(e.g., the one provided to @racket[make-rename-transformer]). If a +transformer binding has both @racket[prop:set!-transformer] ad +@racket[prop:rename-transformer] properties, the latter takes precedence. -Otherwise, evaluates @scheme[expr] and installs the result into the -location for @scheme[id], which must be bound as a local variable or +Otherwise, evaluates @racket[expr] and installs the result into the +location for @racket[id], which must be bound as a local variable or defined as a @tech{top-level variable} or @tech{module-level -variable}. If @scheme[id] refers to an imported binding, a syntax -error is reported. If @scheme[id] refers to a @tech{top-level +variable}. If @racket[id] refers to an imported binding, a syntax +error is reported. If @racket[id] refers to a @tech{top-level variable} that has not been defined, the @exnraise[exn:fail:contract]. -See also @scheme[compile-allow-set!-undefined]. +See also @racket[compile-allow-set!-undefined]. @defexamples[ (define x 12) @@ -2259,11 +2254,11 @@ x @defform[(set!-values (id ...) expr)]{ -Assuming that all @scheme[id]s refer to variables, this form evaluates -@scheme[expr], which must produce as many values as supplied -@scheme[id]s. The location of each @scheme[id] is filled wih to the -corresponding value from @scheme[expr] in the same way as for -@scheme[set!]. +Assuming that all @racket[id]s refer to variables, this form evaluates +@racket[expr], which must produce as many values as supplied +@racket[id]s. The location of each @racket[id] is filled wih to the +corresponding value from @racket[expr] in the same way as for +@racket[set!]. @mz-examples[ (let ([a 1] @@ -2272,75 +2267,75 @@ corresponding value from @scheme[expr] in the same way as for (list a b)) ] -More generally, the @scheme[set!-values] form is expanded to +More generally, the @racket[set!-values] form is expanded to -@schemeblock[ +@racketblock[ (let-values ([(_tmp-id ...) expr]) (set! id _tmp-id) ...) ] -which triggers further expansion if any @scheme[id] has a transformer +which triggers further expansion if any @racket[id] has a transformer binding to an @tech{assignment transformer}.} @;------------------------------------------------------------------------ @include-section["for.scrbl"] @;------------------------------------------------------------------------ -@section[#:tag "wcm"]{Continuation Marks: @scheme[with-continuation-mark]} +@section[#:tag "wcm"]{Continuation Marks: @racket[with-continuation-mark]} @defform[(with-continuation-mark key-expr val-expr result-expr)]{ -The @scheme[key-expr], @scheme[mark-expr], and @scheme[result-expr] -expressions are evaluated in order. After @scheme[key-expr] is -evaluated to obtain a key and @scheme[mark-expr] is evaluated to +The @racket[key-expr], @racket[mark-expr], and @racket[result-expr] +expressions are evaluated in order. After @racket[key-expr] is +evaluated to obtain a key and @racket[mark-expr] is evaluated to obtain a mark, the key is mapped to the mark in the current continuation's initial frame. If the frame already has a mark for the -key, it is replaced. Finally, the @scheme[result-expr] is evaluated; -the continuation for evaluating @scheme[result-expr] is the -continuation of the @scheme[with-continuation-mark] expression (so the -result of the @scheme[result-expr] is the result of the -@scheme[with-continuation-mark] expression, and @scheme[result-expr] -is in tail position for the @scheme[with-continuation-mark] +key, it is replaced. Finally, the @racket[result-expr] is evaluated; +the continuation for evaluating @racket[result-expr] is the +continuation of the @racket[with-continuation-mark] expression (so the +result of the @racket[result-expr] is the result of the +@racket[with-continuation-mark] expression, and @racket[result-expr] +is in tail position for the @racket[with-continuation-mark] expression). @moreref["contmarks"]{continuation marks}} @;------------------------------------------------------------------------ -@section[#:tag "quasiquote"]{Quasiquoting: @scheme[quasiquote], @scheme[unquote], and @scheme[unquote-splicing]} +@section[#:tag "quasiquote"]{Quasiquoting: @racket[quasiquote], @racket[unquote], and @racket[unquote-splicing]} @defform[(quasiquote datum)]{ -The same as @scheme[(quote datum)] if @scheme[datum] does not include -@scheme[(#,unquote-id _expr)] or @scheme[(#,unquote-splicing-id _expr)]. An -@scheme[(#,unquote-id _expr)] form escapes from the quote, however, -and the result of the @scheme[_expr] takes the place of the -@scheme[(#,unquote-id _expr)] form in the @scheme[quasiquote] result. An -@scheme[(#,unquote-splicing-id _expr)] similarly escapes, but the -@scheme[_expr] must produce a list, and its elements are spliced as -multiple values place of the @scheme[(#,unquote-splicing-id _expr)], which -must appear as the @scheme[car] or a quoted pair, as an element of a +The same as @racket[(quote datum)] if @racket[datum] does not include +@racket[(#,unquote-id _expr)] or @racket[(#,unquote-splicing-id _expr)]. An +@racket[(#,unquote-id _expr)] form escapes from the quote, however, +and the result of the @racket[_expr] takes the place of the +@racket[(#,unquote-id _expr)] form in the @racket[quasiquote] result. An +@racket[(#,unquote-splicing-id _expr)] similarly escapes, but the +@racket[_expr] must produce a list, and its elements are spliced as +multiple values place of the @racket[(#,unquote-splicing-id _expr)], which +must appear as the @racket[car] or a quoted pair, as an element of a quoted vector, or as an element of a quoted @tech{prefab} structure; -in the case of a pair, if the @scheme[cdr] of the relevant quoted pair -is empty, then @scheme[_expr] need not produce a list, and its result +in the case of a pair, if the @racket[cdr] of the relevant quoted pair +is empty, then @racket[_expr] need not produce a list, and its result is used directly in place of the quoted pair (in the same way that -@scheme[append] accepts a non-list final argument). In a quoted -@tech{hash table}, an @scheme[(#,unquote-id _expr)] or -@scheme[(#,unquote-splicing-id _expr)] expression escapes only in the +@racket[append] accepts a non-list final argument). In a quoted +@tech{hash table}, an @racket[(#,unquote-id _expr)] or +@racket[(#,unquote-splicing-id _expr)] expression escapes only in the second element of an entry pair (i.e., the value), while entry keys -are always implicitly quoted. If @scheme[unquote] or -@scheme[unquote-splicing] appears within @scheme[quasiquote] in any -other way than as @scheme[(#,unquote-id _expr)] or -@scheme[(#,unquote-splicing-id _expr)], a syntax error is reported. +are always implicitly quoted. If @racket[unquote] or +@racket[unquote-splicing] appears within @racket[quasiquote] in any +other way than as @racket[(#,unquote-id _expr)] or +@racket[(#,unquote-splicing-id _expr)], a syntax error is reported. @mz-examples[ -(eval:alts (#,(scheme quasiquote) (0 1 2)) `(0 1 2)) -(eval:alts (#,(scheme quasiquote) (0 (#,unquote-id (+ 1 2)) 4)) `(0 ,(+ 1 2) 4)) -(eval:alts (#,(scheme quasiquote) (0 (#,unquote-splicing-id (list 1 2)) 4)) `(0 ,@(list 1 2) 4)) -(eval:alts (#,(scheme quasiquote) (0 (#,unquote-splicing-id 1) 4)) `(0 ,@1 4)) -(eval:alts (#,(scheme quasiquote) (0 (#,unquote-splicing-id 1))) `(0 ,@1)) +(eval:alts (#,(racket quasiquote) (0 1 2)) `(0 1 2)) +(eval:alts (#,(racket quasiquote) (0 (#,unquote-id (+ 1 2)) 4)) `(0 ,(+ 1 2) 4)) +(eval:alts (#,(racket quasiquote) (0 (#,unquote-splicing-id (list 1 2)) 4)) `(0 ,@(list 1 2) 4)) +(eval:alts (#,(racket quasiquote) (0 (#,unquote-splicing-id 1) 4)) `(0 ,@1 4)) +(eval:alts (#,(racket quasiquote) (0 (#,unquote-splicing-id 1))) `(0 ,@1)) ] -A @scheme[quasiquote], @scheme[unquote], or @scheme[unquote-splicing] +A @racket[quasiquote], @racket[unquote], or @racket[unquote-splicing] form is typically abbreviated with @litchar{`}, @litchar{,}, or @litchar[",@"], respectively. See also @secref["parse-quote"]. @@ -2348,55 +2343,55 @@ form is typically abbreviated with @litchar{`}, @litchar{,}, or `(0 1 2) `(1 ,(+ 1 2) 4) `#s(stuff 1 ,(+ 1 2) 4) -(eval:alts #,(schemefont (schemevalfont "`#hash((\"a\" . ") "," (scheme (+ 1 2)) (schemevalfont "))")) #hash(("a" . 3))) +(eval:alts #,(racketfont (racketvalfont "`#hash((\"a\" . ") "," (racket (+ 1 2)) (racketvalfont "))")) #hash(("a" . 3))) `#hash((,(+ 1 2) . "a")) `(1 ,@(list 1 2) 4) `#(1 ,@(list 1 2) 4) ] -A @scheme[quasiquote] form within the original @scheme[datum] -increments the level of quasiquotation: within the @scheme[quasiquote] -form, each @scheme[unquote] or @scheme[unquote-splicing] is preserved, -but a further nested @scheme[unquote] or @scheme[unquote-splicing] -escapes. Multiple nestings of @scheme[quasiquote] require multiple -nestings of @scheme[unquote] or @scheme[unquote-splicing] to escape. +A @racket[quasiquote] form within the original @racket[datum] +increments the level of quasiquotation: within the @racket[quasiquote] +form, each @racket[unquote] or @racket[unquote-splicing] is preserved, +but a further nested @racket[unquote] or @racket[unquote-splicing] +escapes. Multiple nestings of @racket[quasiquote] require multiple +nestings of @racket[unquote] or @racket[unquote-splicing] to escape. @mz-examples[ `(1 `,(+ 1 ,(+ 2 3)) 4) `(1 ```,,@,,@(list (+ 1 2)) 4) ] -The @scheme[quasiquote] form allocates only as many fresh cons cells, -vectors, and boxes as are needed without analyzing @scheme[unquote] -and @scheme[unquote-splicing] expressions. For example, in +The @racket[quasiquote] form allocates only as many fresh cons cells, +vectors, and boxes as are needed without analyzing @racket[unquote] +and @racket[unquote-splicing] expressions. For example, in -@schemeblock[ +@racketblock[ `(,1 2 3) ] -a single tail @scheme['(2 3)] is used for every evaluation of the -@scheme[quasiquote] expression. +a single tail @racket['(2 3)] is used for every evaluation of the +@racket[quasiquote] expression. } @defidform[unquote]{ -See @scheme[quasiquote], where @scheme[unquote] is recognized as an -escape. An @scheme[unquote] form as an expression is a syntax error.} +See @racket[quasiquote], where @racket[unquote] is recognized as an +escape. An @racket[unquote] form as an expression is a syntax error.} @defidform[unquote-splicing]{ -See @scheme[quasiquote], where @scheme[unquote-splicing] is recognized as an -escape. An @scheme[unquote-splicing] form as an expression is a syntax error.} +See @racket[quasiquote], where @racket[unquote-splicing] is recognized as an +escape. An @racket[unquote-splicing] form as an expression is a syntax error.} @;------------------------------------------------------------------------ -@section{Syntax Quoting: @scheme[quote-syntax]} +@section{Syntax Quoting: @racket[quote-syntax]} @defform[(quote-syntax datum)]{ Produces a @tech{syntax object} that preserves the @tech{lexical information} and source-location information attached to -@scheme[datum] at expansion time. +@racket[datum] at expansion time. @mz-examples[ (syntax? (quote-syntax x)) @@ -2404,33 +2399,33 @@ information} and source-location information attached to } @;------------------------------------------------------------------------ -@section[#:tag "#%top-interaction"]{Interaction Wrapper: @scheme[#%top-interaction]} +@section[#:tag "#%top-interaction"]{Interaction Wrapper: @racket[#%top-interaction]} @defform[(#%top-interaction . form)]{ -Expands to simply @scheme[form]. The @scheme[#%top-interaction] form -is similar to @scheme[#%app] and @scheme[#%module-begin], in that it +Expands to simply @racket[form]. The @racket[#%top-interaction] form +is similar to @racket[#%app] and @racket[#%module-begin], in that it provides a hook to control interactive evaluation through -@scheme[load] (more precisely, the default @tech{load handler}) or -@scheme[read-eval-print-loop].} +@racket[load] (more precisely, the default @tech{load handler}) or +@racket[read-eval-print-loop].} @;------------------------------------------------------------------------ @include-section["package.scrbl"] @;------------------------------------------------------------------------ -@section[#:tag "nest"]{Flattening Syntactic Sequences: @scheme[nest]} +@section[#:tag "nest"]{Flattening Syntactic Sequences: @racket[nest]} @note-lib[racket/nest] @defform[(nest ([datum ...+] ...) body ...+)]{ Combines nested expressions that syntactically drift to the right into -a more linear textual format, much in the same way that @scheme[let*] -linearizes a sequence of nested @scheme[let] expressions. +a more linear textual format, much in the same way that @racket[let*] +linearizes a sequence of nested @racket[let] expressions. For example, -@schemeblock[ +@racketblock[ (nest ([let ([x 10] [y 6])] [with-handlers ([exn:fail? (lambda (x) 15)])] @@ -2441,7 +2436,7 @@ For example, is equivalent to -@schemeblock[ +@racketblock[ (let ([x 10] [y 6]) (with-handlers ([exn:fail? (lambda (x) 15)]) @@ -2450,11 +2445,11 @@ is equivalent to (display (+ d r)))))) ] -The @scheme[nest] form is unusual in that it has no semantics apart +The @racket[nest] form is unusual in that it has no semantics apart from its expansion, and its implementation is easier to understand than a precise prose description: -@schemeblock[ +@racketblock[ (define-syntax nest (syntax-rules () [(nest () body0 body ...) From 12b95ece4c332d0de8e5e487c878ed0fa417b40b Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 23 Apr 2010 08:11:56 -0600 Subject: [PATCH 06/43] decent Scribble rendering of hash tables --- collects/scribble/racket.ss | 229 +++++++++++++++++++++++------------- 1 file changed, 147 insertions(+), 82 deletions(-) diff --git a/collects/scribble/racket.ss b/collects/scribble/racket.ss index 977a38e7cd..57144a7a99 100644 --- a/collects/scribble/racket.ss +++ b/collects/scribble/racket.ss @@ -489,6 +489,7 @@ => (lambda (converted) ((loop init-line! quote-depth qq?) converted))] [(or (pair? (syntax-e c)) + (forced-pair? (syntax-e c)) (null? (syntax-e c)) (vector? (syntax-e c)) (and (struct? (syntax-e c)) @@ -513,85 +514,92 @@ (to-quoted "`" qq? quote-depth out color? inc-src-col))]) (when (vector? (syntax-e c)) (let ([vec (syntax-e c)]) - (out "#" #;(format "#~a" (vector-length vec)) p-color) + (out "#" #; (format "#~a" (vector-length vec)) p-color) (if (zero? (vector-length vec)) (set! src-col (+ src-col (- (syntax-span c) 2))) (set! src-col (+ src-col (- (syntax-column (vector-ref vec 0)) (syntax-column c) - 1)))))) - (when (struct? (syntax-e c)) - (out "#s" p-color) - (set! src-col (+ src-col 2))) - (out (case sh - [(#\[ #\?) "["] - [(#\{) "{"] - [else "("]) - p-color) - (set! src-col (+ src-col 1)) - (hash-set! next-col-map src-col dest-col) - (let lloop ([l (cond - [(vector? (syntax-e c)) + 1))))))) + (when (struct? (syntax-e c)) + (out "#s" p-color) + (set! src-col (+ src-col 2))) + (out (case sh + [(#\[ #\?) "["] + [(#\{) "{"] + [else "("]) + p-color) + (set! src-col (+ src-col 1)) + (hash-set! next-col-map src-col dest-col) + (let lloop ([l (cond + [(vector? (syntax-e c)) (vector->short-list (syntax-e c) syntax-e)] - [(struct? (syntax-e c)) - (let ([l (vector->list (struct->vector (syntax-e c)))]) - ;; Need to build key datum, syntax-ize it internally, and - ;; set the overall width to fit right: - (cons (let ([key (syntax-ize (prefab-struct-key (syntax-e c)) - (+ 3 (or (syntax-column c) 0)) - (or (syntax-line c) 1))] - [end (if (pair? (cdr l)) - (and (equal? (syntax-line c) (syntax-line (cadr l))) - (syntax-column (cadr l))) - (and (syntax-column c) - (+ (syntax-column c) (syntax-span c))))]) - (if end - (datum->syntax #f - (syntax-e key) - (vector #f (syntax-line key) - (syntax-column key) - (syntax-position key) - (- end 1 (syntax-column key)))) - end)) - (cdr l)))] - [(struct-proxy? (syntax-e c)) - (cons - (struct-proxy-name (syntax-e c)) - (struct-proxy-content (syntax-e c)))] - [else c])] - [first-qq? (and qq? (not (struct-proxy? (syntax-e c))))]) - (cond - [(and (syntax? l) - (pair? (syntax-e l)) - (not (and (memq (syntax-e (car (syntax-e l))) - '(quote unquote syntax unsyntax quasiquote quasiunsyntax)) - (let ([v (syntax->list l)]) - (and v (= 2 (length v)))) - (or (not qq?) - (quote-depth . > . 1) - (not (memq (syntax-e (car (syntax-e l))) - '(unquote unquote-splicing))))))) - (lloop (syntax-e l) first-qq?)] - [(or (null? l) - (and (syntax? l) - (null? (syntax-e l)))) - (void)] - [(pair? l) - ((loop init-line! quote-depth first-qq?) (car l)) - (lloop (cdr l) qq?)] - [else - (advance l init-line! -2) - (out ". " (if (positive? quote-depth) value-color paren-color)) - (set! src-col (+ src-col 3)) - (hash-set! next-col-map src-col dest-col) - ((loop init-line! quote-depth first-qq?) l)])) - (out (case sh - [(#\[ #\?) "]"] - [(#\{) "}"] - [else ")"]) - p-color) - (set! src-col (+ src-col 1)) - #; - (hash-set! next-col-map src-col dest-col)))] + [(struct? (syntax-e c)) + (let ([l (vector->list (struct->vector (syntax-e c)))]) + ;; Need to build key datum, syntax-ize it internally, and + ;; set the overall width to fit right: + (cons (let ([key (syntax-ize (prefab-struct-key (syntax-e c)) + (+ 3 (or (syntax-column c) 0)) + (or (syntax-line c) 1))] + [end (if (pair? (cdr l)) + (and (equal? (syntax-line c) (syntax-line (cadr l))) + (syntax-column (cadr l))) + (and (syntax-column c) + (+ (syntax-column c) (syntax-span c))))]) + (if end + (datum->syntax #f + (syntax-e key) + (vector #f (syntax-line key) + (syntax-column key) + (syntax-position key) + (- end 1 (syntax-column key)))) + end)) + (cdr l)))] + [(struct-proxy? (syntax-e c)) + (cons + (struct-proxy-name (syntax-e c)) + (struct-proxy-content (syntax-e c)))] + [(forced-pair? (syntax-e c)) + (syntax-e c)] + [else c])] + [first-qq? (and qq? (not (struct-proxy? (syntax-e c))))] + [dotted? #f]) + (cond + [(and (syntax? l) + (pair? (syntax-e l)) + (not dotted?) + (not (and (memq (syntax-e (car (syntax-e l))) + '(quote unquote syntax unsyntax quasiquote quasiunsyntax)) + (let ([v (syntax->list l)]) + (and v (= 2 (length v)))) + (or (not qq?) + (quote-depth . > . 1) + (not (memq (syntax-e (car (syntax-e l))) + '(unquote unquote-splicing))))))) + (lloop (syntax-e l) first-qq? #f)] + [(or (null? l) + (and (syntax? l) + (null? (syntax-e l)))) + (void)] + [(and (pair? l) (not dotted?)) + ((loop init-line! quote-depth first-qq?) (car l)) + (lloop (cdr l) qq? #f)] + [(forced-pair? l) + ((loop init-line! quote-depth first-qq?) (forced-pair-car l)) + (lloop (forced-pair-cdr l) qq? #t)] + [else + (advance l init-line! -2) + (out ". " (if (positive? quote-depth) value-color paren-color)) + (set! src-col (+ src-col 3)) + (hash-set! next-col-map src-col dest-col) + ((loop init-line! quote-depth first-qq?) l)])) + (out (case sh + [(#\[ #\?) "]"] + [(#\{) "}"] + [else ")"]) + p-color) + (set! src-col (+ src-col 1)) + #; + (hash-set! next-col-map src-col dest-col))] [(box? (syntax-e c)) (advance c init-line!) (let ([quote-depth (to-quoted "`" qq? quote-depth out color? inc-src-col)]) @@ -612,8 +620,32 @@ (set! src-col (+ src-col delta)) (hash-set! next-col-map src-col dest-col) ((loop init-line! (if qq? quote-depth +inf.0) qq?) - (syntax-ize (hash-map (syntax-e c) cons) - (+ (syntax-column c) delta))) + (let* ([l (sort (hash-map (syntax-e c) cons) + (lambda (a b) + (< (or (syntax-position (cdr a)) -inf.0) + (or (syntax-position (cdr b)) -inf.0))))] + [l2 (for/list ([p (in-list l)]) + (let* ([tentative (syntax-ize (car p) 0)] + [width (syntax-span tentative)]) + (datum->syntax + #f + (make-forced-pair + (syntax-ize (car p) + (max 0 (- (syntax-column (cdr p)) + width + 3)) + (syntax-line (cdr p))) + (cdr p)) + (vector 'here + (syntax-line (cdr p)) + (max 0 (- (syntax-column (cdr p)) width 4)) + (max 1 (- (syntax-position (cdr p)) width 4)) + (+ (syntax-span (cdr p)) width 5)))))]) + (datum->syntax #f l2 (vector (syntax-source c) + (syntax-line c) + (+ (syntax-column c) delta) + (+ (syntax-position c) delta) + (max 1 (- (syntax-span c) delta)))))) (set! src-col (+ orig-col (syntax-span c)))))] [(graph-reference? (syntax-e c)) (advance c init-line!) @@ -760,6 +792,16 @@ stx->loc-s-expr (cdr (vector->list (struct->vector v)))))] [(box? v) `(box ,(stx->loc-s-expr (unbox v)))] + [(hash? v) `(,(cond + [(hash-eq? v) 'make-immutable-hasheq] + [(hash-eqv? v) 'make-immutable-hasheqv] + [else 'make-immutable-hash]) + (list + ,@(hash-map + v + (lambda (k v) + `(cons (quote ,k) + ,(stx->loc-s-expr v))))))] [else `(quote ,v)]))) (define (cvt s) (datum->syntax #'here (stx->loc-s-expr s) #f)) @@ -823,6 +865,8 @@ (set-box! ht (hash-set (unbox ht) '#%graph-count (add1 n))) n))) + (define-struct forced-pair (car cdr)) + (define (do-syntax-ize v col line ht graph? qq) (cond [((syntax-ize-hook) v col) @@ -944,21 +988,25 @@ (set-box! ht orig-ht) (do-syntax-ize v col line ht #t qq)] [else r])))] - [(pair? v) - (let ([orig-ht (unbox ht)] + [(or (pair? v) + (forced-pair? v)) + (let ([carv (if (pair? v) (car v) (forced-pair-car v))] + [cdrv (if (pair? v) (cdr v) (forced-pair-cdr v))] + [orig-ht (unbox ht)] [graph-box (box (graph-count ht graph?))] [qq (and qq (max 1 qq))]) (set-box! ht (hash-set (unbox ht) v graph-box)) (let* ([inc (if graph? (+ 2 (string-length (format "~a" (unbox graph-box)))) 0)] - [a (do-syntax-ize (car v) (+ col 1 inc) line ht #f qq)] - [sep (if (and (pair? (cdr v)) + [a (do-syntax-ize carv (+ col 1 inc) line ht #f qq)] + [sep (if (and (pair? v) + (pair? cdrv) ;; FIXME: what if it turns out to be a graph reference? - (not (hash-ref (unbox ht) (cdr v) #f))) + (not (hash-ref (unbox ht) cdrv #f))) 0 3)] - [b (do-syntax-ize (cdr v) (+ col 1 inc (syntax-span a) sep) line ht #f qq)]) + [b (do-syntax-ize cdrv (+ col 1 inc (syntax-span a) sep) line ht #f qq)]) (let ([r (datum->syntax #f (cons a b) (vector #f line (+ col inc) (+ 1 col inc) @@ -981,5 +1029,22 @@ (box a) (vector #f line col (+ 1 col) (+ 2 (syntax-span a)))))] + [(hash? v) + (let* ([delta (cond + [(hash-eq? v) 7] + [(hash-eqv? v) 8] + [else 6])] + [pairs (do-syntax-ize (hash-map v make-forced-pair) (+ col delta) line ht #f (and qq (max 1 qq)))]) + (datum->syntax #f + ((cond + [(hash-eq? v) make-immutable-hasheq] + [(hash-eqv? v) make-immutable-hasheqv] + [else make-immutable-hash]) + (map (lambda (p) + (let ([p (syntax-e p)]) + (cons (syntax->datum (car p)) + (cdr p)))) + (syntax->list pairs))) + pairs))] [else (datum->syntax #f v (vector #f line col (+ 1 col) 1))]))) From 0fe701a837565aaf9c4e7f0bb36d2ad43464bb95 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 23 Apr 2010 08:19:21 -0600 Subject: [PATCH 07/43] add for/hasheqv for completeness --- collects/racket/private/for.rkt | 9 +++++++++ collects/scribblings/reference/for.scrbl | 7 +++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/collects/racket/private/for.rkt b/collects/racket/private/for.rkt index 6a95bc7236..3a252a81dd 100644 --- a/collects/racket/private/for.rkt +++ b/collects/racket/private/for.rkt @@ -22,6 +22,7 @@ for/last for*/last for/hash for*/hash for/hasheq for*/hasheq + for/hasheqv for*/hasheqv for/fold/derived for*/fold/derived @@ -952,6 +953,14 @@ #`(let-values ([(key val) #,x]) (hash-set table key val)))) + (define-for-variants (for/hasheqv for*/hasheqv) + ([table #hasheqv()]) + (lambda (x) x) + (lambda (rhs) rhs) + (lambda (x) + #`(let-values ([(key val) #,x]) + (hash-set table key val)))) + ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; specific sequences diff --git a/collects/scribblings/reference/for.scrbl b/collects/scribblings/reference/for.scrbl index 809f294f89..963d3dbb62 100644 --- a/collects/scribblings/reference/for.scrbl +++ b/collects/scribblings/reference/for.scrbl @@ -89,12 +89,14 @@ expression is a list of the results in order. @deftogether[( @defform[(for/hash (for-clause ...) body ...+)] @defform[(for/hasheq (for-clause ...) body ...+)] +@defform[(for/hasheqv (for-clause ...) body ...+)] )]{ Like @scheme[for/list], but the result is an immutable @tech{hash table}; @scheme[for/hash] creates a table using @scheme[equal?] to -distinguish keys, and @scheme[for/hasheq] produces a table using -@scheme[eq?]. The last expression in the @scheme[body]s must return +distinguish keys, @scheme[for/hasheq] produces a table using +@scheme[eq?], and @scheme[for/hasheqv] produces a table using +@scheme[eqv?]. The last expression in the @scheme[body]s must return two values: a key and a value to extend the hash table accumulated by the iteration. @@ -212,6 +214,7 @@ nested. @defform[(for*/lists (id ...) (for-clause ...) body ...+)] @defform[(for*/hash (for-clause ...) body ...+)] @defform[(for*/hasheq (for-clause ...) body ...+)] +@defform[(for*/hasheqv (for-clause ...) body ...+)] @defform[(for*/and (for-clause ...) body ...+)] @defform[(for*/or (for-clause ...) body ...+)] @defform[(for*/first (for-clause ...) body ...+)] From ab7f9acee2abdc3ca8aa9f53829d78065080dce8 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 23 Apr 2010 08:26:20 -0600 Subject: [PATCH 08/43] add for/set --- collects/racket/set.rkt | 18 +++++++++++++++++- collects/scribblings/reference/sets.scrbl | 15 +++++++++++++++ collects/tests/mzscheme/set.ss | 4 ++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/collects/racket/set.rkt b/collects/racket/set.rkt index 3574e94fd3..2676037d7f 100644 --- a/collects/racket/set.rkt +++ b/collects/racket/set.rkt @@ -7,7 +7,9 @@ set-member? set-add set-remove set-union set-intersect set-subtract set-map set-for-each - (rename-out [*in-set in-set])) + (rename-out [*in-set in-set]) + for/set for/seteq for/seteqv + for*/set for*/seteq for*/seteqv) (define-struct set (ht) #:omit-define-syntaxes @@ -206,3 +208,17 @@ #t ;; loop args ((hash-iterate-next ht pos)))]]))) + +(define-syntax-rule (define-for for/fold/derived for/set set) + (define-syntax (for/set stx) + (syntax-case stx () + [(_ bindings . body) + (quasisyntax/loc stx + (for/fold/derived #,stx ([s (set)]) bindings (set-add s (let () . body))))]))) + +(define-for for/fold/derived for/set set) +(define-for for*/fold/derived for*/set set) +(define-for for/fold/derived for/seteq seteq) +(define-for for*/fold/derived for*/seteq seteq) +(define-for for/fold/derived for/seteqv seteqv) +(define-for for*/fold/derived for*/seteqv seteqv) diff --git a/collects/scribblings/reference/sets.scrbl b/collects/scribblings/reference/sets.scrbl index 2069cf3ca7..32bcf72223 100644 --- a/collects/scribblings/reference/sets.scrbl +++ b/collects/scribblings/reference/sets.scrbl @@ -109,6 +109,7 @@ Applies the procedure @scheme[proc] to each element in @scheme[set] in an unspecified order, accumulating the results into a list.} + @defproc[(set-for-each [set set?] [proc (any/c . -> . any)]) void?]{ @@ -116,7 +117,21 @@ into a list.} Applies @scheme[proc] to each element in @scheme[set] (for the side-effects of @scheme[proc]) in an unspecified order.} + @defproc[(in-set [set set?]) sequence?]{ Explicitly converts a set to a sequence for use with @scheme[for] and other forms.} + +@deftogether[( +@defform[(for/set (for-clause ...) body ...+)] +@defform[(for/seteq (for-clause ...) body ...+)] +@defform[(for/seteqv (for-clause ...) body ...+)] +@defform[(for*/set (for-clause ...) body ...+)] +@defform[(for*/seteq (for-clause ...) body ...+)] +@defform[(for*/seteqv (for-clause ...) body ...+)] +)]{ + +Analogous to @scheme[for/list] and @scheme[for*/list], but to +construct a set instead of a list.} + diff --git a/collects/tests/mzscheme/set.ss b/collects/tests/mzscheme/set.ss index aa7b0175d1..345ca82960 100644 --- a/collects/tests/mzscheme/set.ss +++ b/collects/tests/mzscheme/set.ss @@ -102,4 +102,8 @@ ;; ---------------------------------------- +(test (set 1 2 3) 'for/set (for/set ([i '(0 1 2)]) (add1 i))) + +;; ---------------------------------------- + (report-errs) From 1812515a573df49fde4636df76ebe3946f84f5ff Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 23 Apr 2010 08:39:26 -0600 Subject: [PATCH 09/43] fix xform setup for reader modules, again --- src/racket/gc2/setup.ss | 1 + 1 file changed, 1 insertion(+) diff --git a/src/racket/gc2/setup.ss b/src/racket/gc2/setup.ss index d2b69fa04d..6b30075d6c 100644 --- a/src/racket/gc2/setup.ss +++ b/src/racket/gc2/setup.ss @@ -84,6 +84,7 @@ mzscheme/lang/reader scheme/base/lang/reader scheme/lang/reader + scheme/private/lang/reader scheme/private/provider/lang/reader racket/base/lang/reader racket/private/lang/reader From 256e3fedd298b79e49c6ac89717a19bbc0369e9b Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Fri, 23 Apr 2010 12:34:17 -0500 Subject: [PATCH 10/43] fixed a bug with zero-sized htdp/image images interactive with 2htdp/image primitives --- collects/2htdp/private/img-err.ss | 24 +++++++++++++++++++++--- collects/2htdp/tests/test-image.ss | 9 +++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/collects/2htdp/private/img-err.ss b/collects/2htdp/private/img-err.ss index f9f24ebc04..a5bd685678 100644 --- a/collects/2htdp/private/img-err.ss +++ b/collects/2htdp/private/img-err.ss @@ -20,6 +20,7 @@ lang/posn scheme/gui/base "../../mrlib/image-core.ss" + (prefix-in cis: "../../mrlib/cache-image-snip.ss") (for-syntax scheme/base scheme/list)) @@ -270,9 +271,26 @@ [else arg])) (define (image-snip->image is) - (bitmap->image (send is get-bitmap) - (or (send is get-bitmap-mask) - (send (send is get-bitmap) get-loaded-mask)))) + (let ([bm (send is get-bitmap)]) + (cond + [(not bm) + ;; this might mean we have a cache-image-snip% + ;; or it might mean we have a useless snip. + (let-values ([(w h) (if (is-a? is cis:cache-image-snip%) + (send is get-size) + (values 0 0))]) + (make-image (make-polygon + (list (make-point 0 0) + (make-point w 0) + (make-point w h) + (make-point 0 h)) + 'solid "black") + (make-bb w h h) + #f))] + [else + (bitmap->image bm + (or (send is get-bitmap-mask) + (send bm get-loaded-mask)))]))) (define (bitmap->image bm [mask-bm (send bm get-loaded-mask)]) (let ([w (send bm get-width)] diff --git a/collects/2htdp/tests/test-image.ss b/collects/2htdp/tests/test-image.ss index e5dd1c84e5..2db4c687f7 100644 --- a/collects/2htdp/tests/test-image.ss +++ b/collects/2htdp/tests/test-image.ss @@ -46,6 +46,7 @@ scheme/class scheme/gui/base schemeunit + (prefix-in 1: htdp/image) (only-in lang/htdp-advanced equal~?)) (require (for-syntax scheme/base)) @@ -202,6 +203,14 @@ (check-close (image-height (rotate 30 (ellipse 0 100 'solid 'blue))) (ceiling (* (cos (* pi 1/6)) 100))) +;; zero-sized htdp/image images should also work +(test (image-width (1:text "" 18 "blue")) + => + 0) +(test (image-height (1:rectangle 10 0 'solid "red")) + => + 0) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; polygon equality From 6542a36fa56aa4316cd4bf77f2dfffeb7d04cfff Mon Sep 17 00:00:00 2001 From: Sam Tobin-Hochstadt Date: Fri, 23 Apr 2010 13:58:34 -0400 Subject: [PATCH 11/43] ignore ~-suffixed files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 186c5e1a58..6f43a4e0ae 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,6 @@ # a common convenient place to set the PLTADDON directory to /add-on/ + +# common backup file suffixes +*~ From 845ebfbeb8625c5b211f1a426a8b80f632716083 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 23 Apr 2010 12:18:42 -0600 Subject: [PATCH 12/43] hash, hasheq, hasheqv, and hash-equal? --- collects/racket/gui/init.ss | 6 - collects/scheme/base.rkt | 4 +- collects/scribblings/reference/hashes.scrbl | 105 +-- collects/scribblings/reference/syntax.scrbl | 10 +- src/racket/src/cstartup.inc | 824 ++++++++++---------- src/racket/src/list.c | 83 ++ src/racket/src/schminc.h | 2 +- src/racket/src/schvers.h | 4 +- 8 files changed, 560 insertions(+), 478 deletions(-) delete mode 100644 collects/racket/gui/init.ss diff --git a/collects/racket/gui/init.ss b/collects/racket/gui/init.ss deleted file mode 100644 index b48a885892..0000000000 --- a/collects/racket/gui/init.ss +++ /dev/null @@ -1,6 +0,0 @@ -#lang racket -(require racket/init - scheme/gui/base) - -(provide (all-from-out racket/init - scheme/gui/base)) diff --git a/collects/scheme/base.rkt b/collects/scheme/base.rkt index 30bbd6da23..a02cf9fd4a 100644 --- a/collects/scheme/base.rkt +++ b/collects/scheme/base.rkt @@ -1,3 +1,5 @@ #lang scheme/private -(provide (except-out (all-from-out racket/base) struct)) +(provide (except-out (all-from-out racket/base) + struct + hash hasheq hasheqv)) diff --git a/collects/scribblings/reference/hashes.scrbl b/collects/scribblings/reference/hashes.scrbl index 2819a19f76..8ca901de97 100644 --- a/collects/scribblings/reference/hashes.scrbl +++ b/collects/scribblings/reference/hashes.scrbl @@ -86,6 +86,11 @@ unpredictable. Returns @scheme[#t] if @scheme[v] is a @tech{hash table}, @scheme[#f] otherwise.} +@defproc[(hash-equal? [hash hash?]) boolean?]{ + +Returns @scheme[#t] if @scheme[hash] compares keys with @scheme[equal?], +@scheme[#f] if it compares with @scheme[eq?] or @scheme[eqv?].} + @defproc[(hash-eqv? [hash hash?]) boolean?]{ Returns @scheme[#t] if @scheme[hash] compares keys with @scheme[eqv?], @@ -102,73 +107,69 @@ Returns @scheme[#t] if @scheme[hash] compares keys with @scheme[eq?], Returns @scheme[#t] if @scheme[hash] retains its keys weakly, @scheme[#f] if it retains keys strongly.} +@deftogether[( +@defproc[(hash [key any/c] [val any/c] ... ...) (and/c hash? hash-equal? immutable?)] +@defproc[(hasheq [key any/c] [val any/c] ... ...) (and/c hash? hash-eq? immutable?)] +@defproc[(hasheqv [key any/c] [val any/c] ... ...) (and/c hash? hash-eqv? immutable?)] +)]{ -@defproc[(make-hash [assocs (listof pair?) null]) hash?]{ +Creates an immutable hash table with each given @scheme[key] mapped to +the following @scheme[val]; each @scheme[key] must have a @scheme[val], +so the total number of arguments to @scheme[hash] must be even. -Creates a mutable hash table that holds keys strongly and that uses -@scheme[equal?] to compare keys. See also @scheme[make-custom-hash]. +The @scheme[hash] procedure creates a table where keys are compared +with @scheme[equal?], @scheme[hasheq] procedure creates a table where +keys are compared with @scheme[eq?], and @scheme[hasheqv] procedure +creates a table where keys are compared with @scheme[eqv?]. + +The @scheme[key] to @scheme[val] mappings are added to the table in +the order that they appear in the argument list, so later mappings can +hide earlier mappings if the @scheme[key]s are equal.} + +@deftogether[( +@defproc[(make-hash [assocs (listof pair?) null]) (and/c hash? hash-equal?)] +@defproc[(make-hasheqv [assocs (listof pair?) null]) (and/c hash? hash-eqv?)] +@defproc[(make-hasheq [assocs (listof pair?) null]) (and/c hash? hash-eq?)] +)]{ + +Creates a mutable hash table that holds keys strongly. + +The @scheme[make-hash] procedure creates a table where keys are +compared with @scheme[equal?], @scheme[make-hasheq] procedure creates +a table where keys are compared with @scheme[eq?], and +@scheme[make-hasheqv] procedure creates a table where keys are +compared with @scheme[eqv?]. The table is initialized with the content of @scheme[assocs]. In each element of @scheme[assocs], the @scheme[car] is a key, and the @scheme[cdr] is the corresponding value. The mappings are added to the table in the order that they appear in @scheme[assocs], so later -mappings can hide earlier mappings.} +mappings can hide earlier mappings. +See also @scheme[make-custom-hash].} -@defproc[(make-hasheqv [assocs (listof pair?) null]) (and/c hash? hash-eqv?)]{ - -Creates a mutable hash table that holds keys strongly and that -uses @scheme[eqv?] to compare keys. The table is initialized with the -content of @scheme[assocs] as in @scheme[make-hash].} - - -@defproc[(make-hasheq [assocs (listof pair?) null]) (and/c hash? hash-eq?)]{ - -Creates a mutable hash table that holds keys strongly and that -uses @scheme[eq?] to compare keys. The table is initialized with the -content of @scheme[assocs] as in @scheme[make-hash].} - - -@defproc[(make-weak-hash [assocs (listof pair?) null]) (and/c hash? hash-weak?)]{ - -Creates a mutable hash table that holds keys weakly and that -uses @scheme[equal?] to compare keys; see also -@scheme[make-weak-custom-hash]. The table is initialized with the -content of @scheme[assocs] as in @scheme[make-hash].} - - -@defproc[(make-weak-hasheqv [assocs (listof pair?) null]) (and/c hash? hash-eqv? hash-weak?)]{ - -Creates a mutable hash table that holds keys weakly and that -uses @scheme[eqv?] to compare keys. The table is initialized with the -content of @scheme[assocs] as in @scheme[make-hash].} - - -@defproc[(make-weak-hasheq [assocs (listof pair?) null]) (and/c hash? hash-eq? hash-weak?)]{ - -Creates a mutable hash table that holds keys weakly and that -uses @scheme[eq?] to compare keys. The table is initialized with the -content of @scheme[assocs] as in @scheme[make-hash].} +@deftogether[( +@defproc[(make-weak-hash [assocs (listof pair?) null]) (and/c hash? hash-equal? hash-weak?)] +@defproc[(make-weak-hasheqv [assocs (listof pair?) null]) (and/c hash? hash-eqv? hash-weak?)] +@defproc[(make-weak-hasheq [assocs (listof pair?) null]) (and/c hash? hash-eq? hash-weak?)] +)]{ +Like @scheme[make-hash], @scheme[make-hasheq], and +@scheme[make-hasheqv], but creates a mutable hash table that holds +keys weakly.} +@deftogether[( @defproc[(make-immutable-hash [assocs (listof pair?)]) - (and/c hash? immutable?)]{ - -Creates an immutable hash table that compares keys with -@scheme[equal?]. The table is created with the content of -@scheme[assocs] as in @scheme[make-hash].} - + (and/c hash? hash-equal? immutable?)] @defproc[(make-immutable-hasheqv [assocs (listof pair?)]) - (and/c hash? hash-eqv? immutable?)]{ - -Like @scheme[make-immutable-hash], but the resulting hash table -compares keys with @scheme[eqv?].} - + (and/c hash? hash-eqv? immutable?)] @defproc[(make-immutable-hasheq [assocs (listof pair?)]) - (and/c hash? hash-eq? immutable?)]{ + (and/c hash? hash-eq? immutable?)] +)]{ -Like @scheme[make-immutable-hash], but the resulting hash table -compares keys with @scheme[eq?].} +Like @scheme[hash], @scheme[hasheq], and @scheme[hasheqv], but accepts +the key--value mapping in association-list form like +@scheme[make-hash], @scheme[make-hasheq], and @scheme[make-hasheqv].} @defproc[(hash-set! [hash (and/c hash? (not/c immutable?))] diff --git a/collects/scribblings/reference/syntax.scrbl b/collects/scribblings/reference/syntax.scrbl index 436b071eb1..26e4eb4f64 100644 --- a/collects/scribblings/reference/syntax.scrbl +++ b/collects/scribblings/reference/syntax.scrbl @@ -49,11 +49,13 @@ Within such specifications, @itemize[ - @item{@racket[...] indicates zero or more - repetitions of the preceding datum.} + @item{@racket[...] indicates zero or more repetitions of the + preceding datum; more generally, @math{N} consecutive + @racket[...]s a row indicate a consecutive repetition of the + preceding @math{N} datums.} - @item{@racket[...+] indicates one or - more repetitions of the preceding datum.} + @item{@racket[...+] indicates one or more repetitions of the + preceding datum.} @item{Italic meta-identifiers play the role of non-terminals. Some meta-identifier names imply syntactic constraints: diff --git a/src/racket/src/cstartup.inc b/src/racket/src/cstartup.inc index bf363c0509..8907f6b94c 100644 --- a/src/racket/src/cstartup.inc +++ b/src/racket/src/cstartup.inc @@ -1,78 +1,78 @@ { - SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,8,52,46,50,46,53,46,49,48,51,0,0,0,1,0,0,10,0,13, -0,22,0,26,0,31,0,38,0,51,0,58,0,63,0,68,0,72,0,79,0, + SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,8,52,46,50,46,53,46,49,49,51,0,0,0,1,0,0,10,0,13, +0,22,0,29,0,42,0,46,0,53,0,57,0,62,0,65,0,70,0,75,0, 82,0,88,0,102,0,116,0,119,0,125,0,129,0,131,0,142,0,144,0,158, 0,165,0,187,0,189,0,203,0,14,1,43,1,54,1,65,1,75,1,111,1, 144,1,177,1,236,1,46,2,124,2,190,2,195,2,215,2,106,3,126,3,177, 3,243,3,128,4,14,5,66,5,89,5,168,5,0,0,109,7,0,0,69,35, -37,109,105,110,45,115,116,120,29,11,11,68,104,101,114,101,45,115,116,120,63, -108,101,116,64,99,111,110,100,66,117,110,108,101,115,115,72,112,97,114,97,109, -101,116,101,114,105,122,101,66,100,101,102,105,110,101,64,119,104,101,110,64,108, -101,116,42,63,97,110,100,66,108,101,116,114,101,99,62,111,114,65,113,117,111, +37,109,105,110,45,115,116,120,29,11,11,68,104,101,114,101,45,115,116,120,66, +108,101,116,114,101,99,72,112,97,114,97,109,101,116,101,114,105,122,101,63,108, +101,116,66,100,101,102,105,110,101,63,97,110,100,64,108,101,116,42,62,111,114, +64,119,104,101,110,64,99,111,110,100,66,117,110,108,101,115,115,65,113,117,111, 116,101,29,94,2,14,68,35,37,107,101,114,110,101,108,11,29,94,2,14,68, 35,37,112,97,114,97,109,122,11,62,105,102,65,98,101,103,105,110,63,115,116, 120,61,115,70,108,101,116,45,118,97,108,117,101,115,61,120,73,108,101,116,114, 101,99,45,118,97,108,117,101,115,66,108,97,109,98,100,97,1,20,112,97,114, 97,109,101,116,101,114,105,122,97,116,105,111,110,45,107,101,121,61,118,73,100, -101,102,105,110,101,45,118,97,108,117,101,115,97,36,11,8,240,81,77,0,0, -95,159,2,16,36,36,159,2,15,36,36,159,2,15,36,36,16,20,2,4,2, -2,2,6,2,2,2,8,2,2,2,7,2,2,2,9,2,2,2,10,2,2, -2,11,2,2,2,5,2,2,2,12,2,2,2,13,2,2,97,37,11,8,240, -81,77,0,0,93,159,2,15,36,37,16,2,2,3,161,2,2,37,2,3,2, -2,2,3,96,11,11,8,240,81,77,0,0,16,0,96,38,11,8,240,81,77, +101,102,105,110,101,45,118,97,108,117,101,115,97,36,11,8,240,155,78,0,0, +95,159,2,16,36,36,159,2,15,36,36,159,2,15,36,36,16,20,2,5,2, +2,2,6,2,2,2,7,2,2,2,8,2,2,2,10,2,2,2,9,2,2, +2,4,2,2,2,11,2,2,2,12,2,2,2,13,2,2,97,37,11,8,240, +155,78,0,0,93,159,2,15,36,37,16,2,2,3,161,2,2,37,2,3,2, +2,2,3,96,11,11,8,240,155,78,0,0,16,0,96,38,11,8,240,155,78, 0,0,16,0,13,16,4,36,29,11,11,2,2,11,18,16,2,99,64,104,101, -114,101,8,32,8,31,8,30,8,29,8,28,93,8,224,88,77,0,0,95,9, -8,224,88,77,0,0,2,2,27,248,22,143,4,195,249,22,136,4,80,158,39, +114,101,8,32,8,31,8,30,8,29,8,28,93,8,224,162,78,0,0,95,9, +8,224,162,78,0,0,2,2,27,248,22,147,4,195,249,22,140,4,80,158,39, 36,251,22,81,2,17,248,22,96,199,12,249,22,71,2,18,248,22,98,201,27, -248,22,143,4,195,249,22,136,4,80,158,39,36,251,22,81,2,17,248,22,96, -199,249,22,71,2,18,248,22,98,201,12,27,248,22,73,248,22,143,4,196,28, +248,22,147,4,195,249,22,140,4,80,158,39,36,251,22,81,2,17,248,22,96, +199,249,22,71,2,18,248,22,98,201,12,27,248,22,73,248,22,147,4,196,28, 248,22,79,193,20,15,159,37,36,37,28,248,22,79,248,22,73,194,248,22,72, -193,249,22,136,4,80,158,39,36,251,22,81,2,17,248,22,72,199,249,22,71, -2,11,248,22,73,201,11,18,16,2,101,10,8,32,8,31,8,30,8,29,8, -28,16,4,11,11,2,19,3,1,8,101,110,118,49,50,55,57,51,16,4,11, -11,2,20,3,1,8,101,110,118,49,50,55,57,52,93,8,224,89,77,0,0, -95,9,8,224,89,77,0,0,2,2,27,248,22,73,248,22,143,4,196,28,248, +193,249,22,140,4,80,158,39,36,251,22,81,2,17,248,22,72,199,249,22,71, +2,8,248,22,73,201,11,18,16,2,101,10,8,32,8,31,8,30,8,29,8, +28,16,4,11,11,2,19,3,1,8,101,110,118,49,50,54,48,50,16,4,11, +11,2,20,3,1,8,101,110,118,49,50,54,48,51,93,8,224,163,78,0,0, +95,9,8,224,163,78,0,0,2,2,27,248,22,73,248,22,147,4,196,28,248, 22,79,193,20,15,159,37,36,37,28,248,22,79,248,22,73,194,248,22,72,193, -249,22,136,4,80,158,39,36,250,22,81,2,21,248,22,81,249,22,81,248,22, -81,2,22,248,22,72,201,251,22,81,2,17,2,22,2,22,249,22,71,2,13, +249,22,140,4,80,158,39,36,250,22,81,2,21,248,22,81,249,22,81,248,22, +81,2,22,248,22,72,201,251,22,81,2,17,2,22,2,22,249,22,71,2,10, 248,22,73,204,18,16,2,101,11,8,32,8,31,8,30,8,29,8,28,16,4, -11,11,2,19,3,1,8,101,110,118,49,50,55,57,54,16,4,11,11,2,20, -3,1,8,101,110,118,49,50,55,57,55,93,8,224,90,77,0,0,95,9,8, -224,90,77,0,0,2,2,248,22,143,4,193,27,248,22,143,4,194,249,22,71, -248,22,81,248,22,72,196,248,22,73,195,27,248,22,73,248,22,143,4,23,197, -1,249,22,136,4,80,158,39,36,28,248,22,56,248,22,137,4,248,22,72,23, -198,2,27,249,22,2,32,0,89,162,8,44,37,43,9,222,33,40,248,22,143, +11,11,2,19,3,1,8,101,110,118,49,50,54,48,53,16,4,11,11,2,20, +3,1,8,101,110,118,49,50,54,48,54,93,8,224,164,78,0,0,95,9,8, +224,164,78,0,0,2,2,248,22,147,4,193,27,248,22,147,4,194,249,22,71, +248,22,81,248,22,72,196,248,22,73,195,27,248,22,73,248,22,147,4,23,197, +1,249,22,140,4,80,158,39,36,28,248,22,56,248,22,141,4,248,22,72,23, +198,2,27,249,22,2,32,0,89,162,8,44,37,43,9,222,33,40,248,22,147, 4,248,22,96,23,200,2,250,22,81,2,23,248,22,81,249,22,81,248,22,81, 248,22,72,23,204,2,250,22,82,2,24,249,22,2,22,72,23,204,2,248,22, 98,23,206,2,249,22,71,248,22,72,23,202,1,249,22,2,22,96,23,200,1, 250,22,82,2,21,249,22,2,32,0,89,162,8,44,37,47,9,222,33,41,248, -22,143,4,248,22,72,201,248,22,73,198,27,248,22,143,4,194,249,22,71,248, -22,81,248,22,72,196,248,22,73,195,27,248,22,73,248,22,143,4,23,197,1, -249,22,136,4,80,158,39,36,250,22,82,2,23,249,22,2,32,0,89,162,8, -44,37,47,9,222,33,43,248,22,143,4,248,22,72,201,248,22,73,198,27,248, -22,73,248,22,143,4,196,27,248,22,143,4,248,22,72,195,249,22,136,4,80, +22,147,4,248,22,72,201,248,22,73,198,27,248,22,147,4,194,249,22,71,248, +22,81,248,22,72,196,248,22,73,195,27,248,22,73,248,22,147,4,23,197,1, +249,22,140,4,80,158,39,36,250,22,82,2,23,249,22,2,32,0,89,162,8, +44,37,47,9,222,33,43,248,22,147,4,248,22,72,201,248,22,73,198,27,248, +22,73,248,22,147,4,196,27,248,22,147,4,248,22,72,195,249,22,140,4,80, 158,40,36,28,248,22,79,195,250,22,82,2,21,9,248,22,73,199,250,22,81, -2,4,248,22,81,248,22,72,199,250,22,82,2,10,248,22,73,201,248,22,73, -202,27,248,22,73,248,22,143,4,23,197,1,27,249,22,1,22,85,249,22,2, -22,143,4,248,22,143,4,248,22,72,199,249,22,136,4,80,158,40,36,251,22, +2,6,248,22,81,248,22,72,199,250,22,82,2,9,248,22,73,201,248,22,73, +202,27,248,22,73,248,22,147,4,23,197,1,27,249,22,1,22,85,249,22,2, +22,147,4,248,22,147,4,248,22,72,199,249,22,140,4,80,158,40,36,251,22, 81,1,22,119,105,116,104,45,99,111,110,116,105,110,117,97,116,105,111,110,45, 109,97,114,107,2,25,250,22,82,1,23,101,120,116,101,110,100,45,112,97,114, 97,109,101,116,101,114,105,122,97,116,105,111,110,21,95,1,27,99,111,110,116, 105,110,117,97,116,105,111,110,45,109,97,114,107,45,115,101,116,45,102,105,114, 115,116,11,2,25,201,250,22,82,2,21,9,248,22,73,203,27,248,22,73,248, -22,143,4,196,28,248,22,79,193,20,15,159,37,36,37,249,22,136,4,80,158, -39,36,27,248,22,143,4,248,22,72,197,28,249,22,177,8,62,61,62,248,22, -137,4,248,22,96,196,250,22,81,2,21,248,22,81,249,22,81,21,93,2,26, -248,22,72,199,250,22,82,2,5,249,22,81,2,26,249,22,81,248,22,105,203, -2,26,248,22,73,202,251,22,81,2,17,28,249,22,177,8,248,22,137,4,248, +22,147,4,196,28,248,22,79,193,20,15,159,37,36,37,249,22,140,4,80,158, +39,36,27,248,22,147,4,248,22,72,197,28,249,22,181,8,62,61,62,248,22, +141,4,248,22,96,196,250,22,81,2,21,248,22,81,249,22,81,21,93,2,26, +248,22,72,199,250,22,82,2,12,249,22,81,2,26,249,22,81,248,22,105,203, +2,26,248,22,73,202,251,22,81,2,17,28,249,22,181,8,248,22,141,4,248, 22,72,200,64,101,108,115,101,10,248,22,72,197,250,22,82,2,21,9,248,22, -73,200,249,22,71,2,5,248,22,73,202,100,8,32,8,31,8,30,8,29,8, -28,16,4,11,11,2,19,3,1,8,101,110,118,49,50,56,49,57,16,4,11, -11,2,20,3,1,8,101,110,118,49,50,56,50,48,93,8,224,91,77,0,0, -18,16,2,158,94,10,64,118,111,105,100,8,48,95,9,8,224,91,77,0,0, -2,2,27,248,22,73,248,22,143,4,196,249,22,136,4,80,158,39,36,28,248, -22,56,248,22,137,4,248,22,72,197,250,22,81,2,27,248,22,81,248,22,72, -199,248,22,96,198,27,248,22,137,4,248,22,72,197,250,22,81,2,27,248,22, +73,200,249,22,71,2,12,248,22,73,202,100,8,32,8,31,8,30,8,29,8, +28,16,4,11,11,2,19,3,1,8,101,110,118,49,50,54,50,56,16,4,11, +11,2,20,3,1,8,101,110,118,49,50,54,50,57,93,8,224,165,78,0,0, +18,16,2,158,94,10,64,118,111,105,100,8,48,95,9,8,224,165,78,0,0, +2,2,27,248,22,73,248,22,147,4,196,249,22,140,4,80,158,39,36,28,248, +22,56,248,22,141,4,248,22,72,197,250,22,81,2,27,248,22,81,248,22,72, +199,248,22,96,198,27,248,22,141,4,248,22,72,197,250,22,81,2,27,248,22, 81,248,22,72,197,250,22,82,2,24,248,22,73,199,248,22,73,202,159,36,20, 105,159,36,16,1,11,16,0,83,158,42,20,103,145,2,1,2,1,2,2,11, 11,11,10,36,80,158,36,36,20,105,159,36,16,0,16,0,16,1,2,3,37, @@ -81,25 +81,25 @@ 11,11,11,11,11,16,10,2,4,2,5,2,6,2,7,2,8,2,9,2,10, 2,11,2,12,2,13,36,46,37,11,11,11,16,0,16,0,16,0,36,36,11, 11,11,11,16,0,16,0,16,0,36,36,16,11,16,5,2,3,20,15,159,36, -36,36,36,20,105,159,36,16,0,16,1,33,33,10,16,5,2,6,89,162,8, +36,36,36,20,105,159,36,16,0,16,1,33,33,10,16,5,2,13,89,162,8, 44,37,53,9,223,0,33,34,36,20,105,159,36,16,1,2,3,16,0,11,16, -5,2,9,89,162,8,44,37,53,9,223,0,33,35,36,20,105,159,36,16,1, -2,3,16,0,11,16,5,2,11,89,162,8,44,37,53,9,223,0,33,36,36, -20,105,159,36,16,1,2,3,16,1,33,37,11,16,5,2,13,89,162,8,44, +5,2,11,89,162,8,44,37,53,9,223,0,33,35,36,20,105,159,36,16,1, +2,3,16,0,11,16,5,2,8,89,162,8,44,37,53,9,223,0,33,36,36, +20,105,159,36,16,1,2,3,16,1,33,37,11,16,5,2,10,89,162,8,44, 37,56,9,223,0,33,38,36,20,105,159,36,16,1,2,3,16,1,33,39,11, -16,5,2,4,89,162,8,44,37,58,9,223,0,33,42,36,20,105,159,36,16, -1,2,3,16,0,11,16,5,2,12,89,162,8,44,37,53,9,223,0,33,44, -36,20,105,159,36,16,1,2,3,16,0,11,16,5,2,10,89,162,8,44,37, +16,5,2,6,89,162,8,44,37,58,9,223,0,33,42,36,20,105,159,36,16, +1,2,3,16,0,11,16,5,2,4,89,162,8,44,37,53,9,223,0,33,44, +36,20,105,159,36,16,1,2,3,16,0,11,16,5,2,9,89,162,8,44,37, 54,9,223,0,33,45,36,20,105,159,36,16,1,2,3,16,0,11,16,5,2, -7,89,162,8,44,37,55,9,223,0,33,46,36,20,105,159,36,16,1,2,3, -16,0,11,16,5,2,5,89,162,8,44,37,58,9,223,0,33,47,36,20,105, -159,36,16,1,2,3,16,1,33,49,11,16,5,2,8,89,162,8,44,37,54, +5,89,162,8,44,37,55,9,223,0,33,46,36,20,105,159,36,16,1,2,3, +16,0,11,16,5,2,12,89,162,8,44,37,58,9,223,0,33,47,36,20,105, +159,36,16,1,2,3,16,1,33,49,11,16,5,2,7,89,162,8,44,37,54, 9,223,0,33,50,36,20,105,159,36,16,1,2,3,16,0,11,16,0,94,2, 15,2,16,93,2,15,9,9,36,0}; EVAL_ONE_SIZED_STR((char *)expr, 2025); } { - SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,8,52,46,50,46,53,46,49,48,65,0,0,0,1,0,0,8,0,21, + SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,8,52,46,50,46,53,46,49,49,65,0,0,0,1,0,0,8,0,21, 0,26,0,43,0,58,0,76,0,92,0,102,0,120,0,140,0,156,0,174,0, 205,0,234,0,0,1,14,1,20,1,34,1,39,1,49,1,57,1,85,1,117, 1,123,1,168,1,213,1,237,1,20,2,22,2,188,2,22,4,63,4,136,5, @@ -132,234 +132,234 @@ 32,111,114,32,98,121,116,101,32,115,116,114,105,110,103,6,36,36,99,97,110, 110,111,116,32,97,100,100,32,97,32,115,117,102,102,105,120,32,116,111,32,97, 32,114,111,111,116,32,112,97,116,104,58,32,5,0,27,20,14,159,80,159,37, -51,38,250,80,159,40,52,38,249,22,27,11,80,159,42,51,38,22,146,13,10, -248,22,169,5,23,196,2,28,248,22,166,6,23,194,2,12,87,94,248,22,183, +51,38,250,80,159,40,52,38,249,22,27,11,80,159,42,51,38,22,150,13,10, +248,22,173,5,23,196,2,28,248,22,170,6,23,194,2,12,87,94,248,22,187, 8,23,194,1,27,20,14,159,80,159,38,51,38,250,80,159,41,52,38,249,22, -27,11,80,159,43,51,38,22,146,13,10,248,22,169,5,23,197,2,28,248,22, -166,6,23,194,2,12,87,94,248,22,183,8,23,194,1,27,20,14,159,80,159, -39,51,38,250,80,159,42,52,38,249,22,27,11,80,159,44,51,38,22,146,13, -10,248,22,169,5,23,198,2,28,248,22,166,6,23,194,2,12,87,94,248,22, -183,8,23,194,1,248,80,159,40,54,37,197,28,248,22,79,23,195,2,9,27, -248,22,72,23,196,2,27,28,248,22,130,14,23,195,2,23,194,1,28,248,22, -129,14,23,195,2,249,22,131,14,23,196,1,250,80,158,43,49,248,22,146,14, -2,20,11,10,250,80,158,41,49,248,22,146,14,2,20,23,197,1,10,28,23, -193,2,249,22,71,248,22,133,14,249,22,131,14,23,198,1,247,22,147,14,27, +27,11,80,159,43,51,38,22,150,13,10,248,22,173,5,23,197,2,28,248,22, +170,6,23,194,2,12,87,94,248,22,187,8,23,194,1,27,20,14,159,80,159, +39,51,38,250,80,159,42,52,38,249,22,27,11,80,159,44,51,38,22,150,13, +10,248,22,173,5,23,198,2,28,248,22,170,6,23,194,2,12,87,94,248,22, +187,8,23,194,1,248,80,159,40,54,37,197,28,248,22,79,23,195,2,9,27, +248,22,72,23,196,2,27,28,248,22,134,14,23,195,2,23,194,1,28,248,22, +133,14,23,195,2,249,22,135,14,23,196,1,250,80,158,43,49,248,22,150,14, +2,20,11,10,250,80,158,41,49,248,22,150,14,2,20,23,197,1,10,28,23, +193,2,249,22,71,248,22,137,14,249,22,135,14,23,198,1,247,22,151,14,27, 248,22,73,23,200,1,28,248,22,79,23,194,2,9,27,248,22,72,23,195,2, -27,28,248,22,130,14,23,195,2,23,194,1,28,248,22,129,14,23,195,2,249, -22,131,14,23,196,1,250,80,158,48,49,248,22,146,14,2,20,11,10,250,80, -158,46,49,248,22,146,14,2,20,23,197,1,10,28,23,193,2,249,22,71,248, -22,133,14,249,22,131,14,23,198,1,247,22,147,14,248,80,159,46,53,37,248, +27,28,248,22,134,14,23,195,2,23,194,1,28,248,22,133,14,23,195,2,249, +22,135,14,23,196,1,250,80,158,48,49,248,22,150,14,2,20,11,10,250,80, +158,46,49,248,22,150,14,2,20,23,197,1,10,28,23,193,2,249,22,71,248, +22,137,14,249,22,135,14,23,198,1,247,22,151,14,248,80,159,46,53,37,248, 22,73,23,199,1,87,94,23,193,1,248,80,159,44,53,37,248,22,73,23,197, 1,87,94,23,193,1,27,248,22,73,23,198,1,28,248,22,79,23,194,2,9, -27,248,22,72,23,195,2,27,28,248,22,130,14,23,195,2,23,194,1,28,248, -22,129,14,23,195,2,249,22,131,14,23,196,1,250,80,158,46,49,248,22,146, -14,2,20,11,10,250,80,158,44,49,248,22,146,14,2,20,23,197,1,10,28, -23,193,2,249,22,71,248,22,133,14,249,22,131,14,23,198,1,247,22,147,14, +27,248,22,72,23,195,2,27,28,248,22,134,14,23,195,2,23,194,1,28,248, +22,133,14,23,195,2,249,22,135,14,23,196,1,250,80,158,46,49,248,22,150, +14,2,20,11,10,250,80,158,44,49,248,22,150,14,2,20,23,197,1,10,28, +23,193,2,249,22,71,248,22,137,14,249,22,135,14,23,198,1,247,22,151,14, 248,80,159,44,53,37,248,22,73,23,199,1,248,80,159,42,53,37,248,22,73, -196,27,248,22,170,13,23,195,2,28,23,193,2,192,87,94,23,193,1,28,248, -22,171,6,23,195,2,27,248,22,128,14,195,28,192,192,248,22,129,14,195,11, -87,94,28,28,248,22,171,13,23,195,2,10,28,248,22,170,13,23,195,2,10, -28,248,22,171,6,23,195,2,28,248,22,128,14,23,195,2,10,248,22,129,14, -23,195,2,11,12,250,22,147,9,76,110,111,114,109,97,108,45,112,97,116,104, +196,27,248,22,174,13,23,195,2,28,23,193,2,192,87,94,23,193,1,28,248, +22,175,6,23,195,2,27,248,22,132,14,195,28,192,192,248,22,133,14,195,11, +87,94,28,28,248,22,175,13,23,195,2,10,28,248,22,174,13,23,195,2,10, +28,248,22,175,6,23,195,2,28,248,22,132,14,23,195,2,10,248,22,133,14, +23,195,2,11,12,250,22,151,9,76,110,111,114,109,97,108,45,112,97,116,104, 45,99,97,115,101,6,42,42,112,97,116,104,32,40,102,111,114,32,97,110,121, 32,115,121,115,116,101,109,41,32,111,114,32,118,97,108,105,100,45,112,97,116, -104,32,115,116,114,105,110,103,23,197,2,28,28,248,22,171,13,23,195,2,249, -22,177,8,248,22,172,13,23,197,2,2,21,249,22,177,8,247,22,190,7,2, -21,27,28,248,22,171,6,23,196,2,23,195,2,248,22,180,7,248,22,175,13, -23,197,2,28,249,22,161,14,0,21,35,114,120,34,94,91,92,92,93,91,92, -92,93,91,63,93,91,92,92,93,34,23,195,2,28,248,22,171,6,195,248,22, -178,13,195,194,27,248,22,146,7,23,195,1,249,22,179,13,248,22,183,7,250, -22,169,14,0,6,35,114,120,34,47,34,28,249,22,161,14,0,22,35,114,120, +104,32,115,116,114,105,110,103,23,197,2,28,28,248,22,175,13,23,195,2,249, +22,181,8,248,22,176,13,23,197,2,2,21,249,22,181,8,247,22,130,8,2, +21,27,28,248,22,175,6,23,196,2,23,195,2,248,22,184,7,248,22,179,13, +23,197,2,28,249,22,165,14,0,21,35,114,120,34,94,91,92,92,93,91,92, +92,93,91,63,93,91,92,92,93,34,23,195,2,28,248,22,175,6,195,248,22, +182,13,195,194,27,248,22,150,7,23,195,1,249,22,183,13,248,22,187,7,250, +22,173,14,0,6,35,114,120,34,47,34,28,249,22,165,14,0,22,35,114,120, 34,91,47,92,92,93,91,46,32,93,43,91,47,92,92,93,42,36,34,23,201, -2,23,199,1,250,22,169,14,0,19,35,114,120,34,91,32,46,93,43,40,91, +2,23,199,1,250,22,173,14,0,19,35,114,120,34,91,32,46,93,43,40,91, 47,92,92,93,42,41,36,34,23,202,1,6,2,2,92,49,80,159,44,37,38, -2,21,28,248,22,171,6,194,248,22,178,13,194,193,87,94,28,28,248,22,170, -13,23,195,2,10,28,248,22,171,6,23,195,2,28,248,22,128,14,23,195,2, -10,248,22,129,14,23,195,2,11,12,250,22,147,9,23,196,2,2,22,23,197, -2,28,248,22,128,14,23,195,2,12,248,22,186,11,249,22,128,11,248,22,136, -7,250,22,155,7,2,23,23,200,1,23,201,1,247,22,23,87,94,28,28,248, -22,170,13,23,195,2,10,28,248,22,171,6,23,195,2,28,248,22,128,14,23, -195,2,10,248,22,129,14,23,195,2,11,12,250,22,147,9,23,196,2,2,22, -23,197,2,28,248,22,128,14,23,195,2,12,248,22,186,11,249,22,128,11,248, -22,136,7,250,22,155,7,2,23,23,200,1,23,201,1,247,22,23,87,94,87, -94,28,28,248,22,170,13,23,195,2,10,28,248,22,171,6,23,195,2,28,248, -22,128,14,23,195,2,10,248,22,129,14,23,195,2,11,12,250,22,147,9,195, -2,22,23,197,2,28,248,22,128,14,23,195,2,12,248,22,186,11,249,22,128, -11,248,22,136,7,250,22,155,7,2,23,199,23,201,1,247,22,23,249,22,3, -89,162,8,44,37,50,9,223,2,33,35,196,87,94,28,28,248,22,170,13,23, -194,2,10,28,248,22,171,6,23,194,2,28,248,22,128,14,23,194,2,10,248, -22,129,14,23,194,2,11,12,250,22,147,9,2,7,2,22,23,196,2,28,248, -22,128,14,23,194,2,12,248,22,186,11,249,22,128,11,248,22,136,7,250,22, -155,7,2,23,2,7,23,200,1,247,22,23,32,38,89,162,8,44,40,55,2, -24,222,33,39,28,248,22,79,23,197,2,87,94,23,196,1,248,22,186,11,249, -22,161,11,251,22,155,7,2,25,2,7,28,248,22,79,23,203,2,87,94,23, -202,1,23,201,1,250,22,1,22,188,13,23,204,1,23,205,1,23,200,1,247, -22,23,27,249,22,188,13,248,22,72,23,200,2,23,197,2,28,248,22,183,13, -23,194,2,27,250,22,1,22,188,13,23,197,1,199,28,248,22,183,13,193,192, +2,21,28,248,22,175,6,194,248,22,182,13,194,193,87,94,28,28,248,22,174, +13,23,195,2,10,28,248,22,175,6,23,195,2,28,248,22,132,14,23,195,2, +10,248,22,133,14,23,195,2,11,12,250,22,151,9,23,196,2,2,22,23,197, +2,28,248,22,132,14,23,195,2,12,248,22,190,11,249,22,132,11,248,22,140, +7,250,22,159,7,2,23,23,200,1,23,201,1,247,22,23,87,94,28,28,248, +22,174,13,23,195,2,10,28,248,22,175,6,23,195,2,28,248,22,132,14,23, +195,2,10,248,22,133,14,23,195,2,11,12,250,22,151,9,23,196,2,2,22, +23,197,2,28,248,22,132,14,23,195,2,12,248,22,190,11,249,22,132,11,248, +22,140,7,250,22,159,7,2,23,23,200,1,23,201,1,247,22,23,87,94,87, +94,28,28,248,22,174,13,23,195,2,10,28,248,22,175,6,23,195,2,28,248, +22,132,14,23,195,2,10,248,22,133,14,23,195,2,11,12,250,22,151,9,195, +2,22,23,197,2,28,248,22,132,14,23,195,2,12,248,22,190,11,249,22,132, +11,248,22,140,7,250,22,159,7,2,23,199,23,201,1,247,22,23,249,22,3, +89,162,8,44,37,50,9,223,2,33,35,196,87,94,28,28,248,22,174,13,23, +194,2,10,28,248,22,175,6,23,194,2,28,248,22,132,14,23,194,2,10,248, +22,133,14,23,194,2,11,12,250,22,151,9,2,7,2,22,23,196,2,28,248, +22,132,14,23,194,2,12,248,22,190,11,249,22,132,11,248,22,140,7,250,22, +159,7,2,23,2,7,23,200,1,247,22,23,32,38,89,162,8,44,40,55,2, +24,222,33,39,28,248,22,79,23,197,2,87,94,23,196,1,248,22,190,11,249, +22,165,11,251,22,159,7,2,25,2,7,28,248,22,79,23,203,2,87,94,23, +202,1,23,201,1,250,22,1,22,128,14,23,204,1,23,205,1,23,200,1,247, +22,23,27,249,22,128,14,248,22,72,23,200,2,23,197,2,28,248,22,187,13, +23,194,2,27,250,22,1,22,128,14,23,197,1,199,28,248,22,187,13,193,192, 251,2,38,198,199,200,248,22,73,202,251,2,38,197,198,199,248,22,73,201,87, -94,87,94,87,94,28,28,248,22,170,13,193,10,28,248,22,171,6,193,28,248, -22,128,14,193,10,248,22,129,14,193,11,12,250,22,147,9,2,7,2,22,195, -28,248,22,128,14,193,12,248,22,186,11,249,22,128,11,248,22,136,7,250,22, -155,7,2,23,2,7,199,247,22,23,249,22,3,32,0,89,162,8,44,37,49, -9,222,33,37,195,27,247,22,148,14,251,2,38,196,197,198,196,32,41,89,162, +94,87,94,87,94,28,28,248,22,174,13,193,10,28,248,22,175,6,193,28,248, +22,132,14,193,10,248,22,133,14,193,11,12,250,22,151,9,2,7,2,22,195, +28,248,22,132,14,193,12,248,22,190,11,249,22,132,11,248,22,140,7,250,22, +159,7,2,23,2,7,199,247,22,23,249,22,3,32,0,89,162,8,44,37,49, +9,222,33,37,195,27,247,22,152,14,251,2,38,196,197,198,196,32,41,89,162, 44,42,59,2,24,222,33,42,28,248,22,79,23,199,2,87,94,23,198,1,248, -23,196,1,251,22,155,7,2,25,23,199,1,28,248,22,79,23,203,2,87,94, -23,202,1,23,201,1,250,22,1,22,188,13,23,204,1,23,205,1,23,198,1, -27,249,22,188,13,248,22,72,23,202,2,23,199,2,28,248,22,183,13,23,194, -2,27,250,22,1,22,188,13,23,197,1,23,202,2,28,248,22,183,13,23,194, +23,196,1,251,22,159,7,2,25,23,199,1,28,248,22,79,23,203,2,87,94, +23,202,1,23,201,1,250,22,1,22,128,14,23,204,1,23,205,1,23,198,1, +27,249,22,128,14,248,22,72,23,202,2,23,199,2,28,248,22,187,13,23,194, +2,27,250,22,1,22,128,14,23,197,1,23,202,2,28,248,22,187,13,23,194, 2,192,87,94,23,193,1,27,248,22,73,23,202,1,28,248,22,79,23,194,2, -87,94,23,193,1,248,23,199,1,251,22,155,7,2,25,23,202,1,28,248,22, -79,23,206,2,87,94,23,205,1,23,204,1,250,22,1,22,188,13,23,207,1, -23,208,1,23,201,1,27,249,22,188,13,248,22,72,23,197,2,23,202,2,28, -248,22,183,13,23,194,2,27,250,22,1,22,188,13,23,197,1,204,28,248,22, -183,13,193,192,253,2,41,203,204,205,206,23,15,248,22,73,201,253,2,41,202, +87,94,23,193,1,248,23,199,1,251,22,159,7,2,25,23,202,1,28,248,22, +79,23,206,2,87,94,23,205,1,23,204,1,250,22,1,22,128,14,23,207,1, +23,208,1,23,201,1,27,249,22,128,14,248,22,72,23,197,2,23,202,2,28, +248,22,187,13,23,194,2,27,250,22,1,22,128,14,23,197,1,204,28,248,22, +187,13,193,192,253,2,41,203,204,205,206,23,15,248,22,73,201,253,2,41,202, 203,204,205,206,248,22,73,200,87,94,23,193,1,27,248,22,73,23,201,1,28, -248,22,79,23,194,2,87,94,23,193,1,248,23,198,1,251,22,155,7,2,25, +248,22,79,23,194,2,87,94,23,193,1,248,23,198,1,251,22,159,7,2,25, 23,201,1,28,248,22,79,23,205,2,87,94,23,204,1,23,203,1,250,22,1, -22,188,13,23,206,1,23,207,1,23,200,1,27,249,22,188,13,248,22,72,23, -197,2,23,201,2,28,248,22,183,13,23,194,2,27,250,22,1,22,188,13,23, -197,1,203,28,248,22,183,13,193,192,253,2,41,202,203,204,205,206,248,22,73, -201,253,2,41,201,202,203,204,205,248,22,73,200,27,247,22,148,14,253,2,41, -198,199,200,201,202,198,87,95,28,28,248,22,171,13,23,194,2,10,28,248,22, -170,13,23,194,2,10,28,248,22,171,6,23,194,2,28,248,22,128,14,23,194, -2,10,248,22,129,14,23,194,2,11,12,252,22,147,9,23,200,2,2,26,36, -23,198,2,23,199,2,28,28,248,22,171,6,23,195,2,10,248,22,159,7,23, -195,2,87,94,23,194,1,12,252,22,147,9,23,200,2,2,27,37,23,198,2, -23,199,1,91,159,39,11,90,161,39,36,11,248,22,191,13,23,197,2,87,94, -23,195,1,87,94,28,192,12,250,22,148,9,23,201,1,2,28,23,199,1,249, -22,7,194,195,91,159,38,11,90,161,38,36,11,87,95,28,28,248,22,171,13, -23,196,2,10,28,248,22,170,13,23,196,2,10,28,248,22,171,6,23,196,2, -28,248,22,128,14,23,196,2,10,248,22,129,14,23,196,2,11,12,252,22,147, -9,2,10,2,26,36,23,200,2,23,201,2,28,28,248,22,171,6,23,197,2, -10,248,22,159,7,23,197,2,12,252,22,147,9,2,10,2,27,37,23,200,2, -23,201,2,91,159,39,11,90,161,39,36,11,248,22,191,13,23,199,2,87,94, -23,195,1,87,94,28,192,12,250,22,148,9,2,10,2,28,23,201,2,249,22, -7,194,195,27,249,22,180,13,250,22,168,14,0,20,35,114,120,35,34,40,63, -58,91,46,93,91,94,46,93,42,124,41,36,34,248,22,176,13,23,201,1,28, -248,22,171,6,23,203,2,249,22,183,7,23,204,1,8,63,23,202,1,28,248, -22,171,13,23,199,2,248,22,172,13,23,199,1,87,94,23,198,1,247,22,173, -13,28,248,22,170,13,194,249,22,188,13,195,194,192,91,159,38,11,90,161,38, -36,11,87,95,28,28,248,22,171,13,23,196,2,10,28,248,22,170,13,23,196, -2,10,28,248,22,171,6,23,196,2,28,248,22,128,14,23,196,2,10,248,22, -129,14,23,196,2,11,12,252,22,147,9,2,11,2,26,36,23,200,2,23,201, -2,28,28,248,22,171,6,23,197,2,10,248,22,159,7,23,197,2,12,252,22, -147,9,2,11,2,27,37,23,200,2,23,201,2,91,159,39,11,90,161,39,36, -11,248,22,191,13,23,199,2,87,94,23,195,1,87,94,28,192,12,250,22,148, -9,2,11,2,28,23,201,2,249,22,7,194,195,27,249,22,180,13,249,22,169, -7,250,22,169,14,0,9,35,114,120,35,34,91,46,93,34,248,22,176,13,23, -203,1,6,1,1,95,28,248,22,171,6,23,202,2,249,22,183,7,23,203,1, -8,63,23,201,1,28,248,22,171,13,23,199,2,248,22,172,13,23,199,1,87, -94,23,198,1,247,22,173,13,28,248,22,170,13,194,249,22,188,13,195,194,192, -249,247,22,138,5,194,11,249,80,159,38,47,37,9,9,249,80,159,38,47,37, -195,9,27,247,22,150,14,249,80,158,39,48,28,23,195,2,27,248,22,188,7, +22,128,14,23,206,1,23,207,1,23,200,1,27,249,22,128,14,248,22,72,23, +197,2,23,201,2,28,248,22,187,13,23,194,2,27,250,22,1,22,128,14,23, +197,1,203,28,248,22,187,13,193,192,253,2,41,202,203,204,205,206,248,22,73, +201,253,2,41,201,202,203,204,205,248,22,73,200,27,247,22,152,14,253,2,41, +198,199,200,201,202,198,87,95,28,28,248,22,175,13,23,194,2,10,28,248,22, +174,13,23,194,2,10,28,248,22,175,6,23,194,2,28,248,22,132,14,23,194, +2,10,248,22,133,14,23,194,2,11,12,252,22,151,9,23,200,2,2,26,36, +23,198,2,23,199,2,28,28,248,22,175,6,23,195,2,10,248,22,163,7,23, +195,2,87,94,23,194,1,12,252,22,151,9,23,200,2,2,27,37,23,198,2, +23,199,1,91,159,39,11,90,161,39,36,11,248,22,131,14,23,197,2,87,94, +23,195,1,87,94,28,192,12,250,22,152,9,23,201,1,2,28,23,199,1,249, +22,7,194,195,91,159,38,11,90,161,38,36,11,87,95,28,28,248,22,175,13, +23,196,2,10,28,248,22,174,13,23,196,2,10,28,248,22,175,6,23,196,2, +28,248,22,132,14,23,196,2,10,248,22,133,14,23,196,2,11,12,252,22,151, +9,2,10,2,26,36,23,200,2,23,201,2,28,28,248,22,175,6,23,197,2, +10,248,22,163,7,23,197,2,12,252,22,151,9,2,10,2,27,37,23,200,2, +23,201,2,91,159,39,11,90,161,39,36,11,248,22,131,14,23,199,2,87,94, +23,195,1,87,94,28,192,12,250,22,152,9,2,10,2,28,23,201,2,249,22, +7,194,195,27,249,22,184,13,250,22,172,14,0,20,35,114,120,35,34,40,63, +58,91,46,93,91,94,46,93,42,124,41,36,34,248,22,180,13,23,201,1,28, +248,22,175,6,23,203,2,249,22,187,7,23,204,1,8,63,23,202,1,28,248, +22,175,13,23,199,2,248,22,176,13,23,199,1,87,94,23,198,1,247,22,177, +13,28,248,22,174,13,194,249,22,128,14,195,194,192,91,159,38,11,90,161,38, +36,11,87,95,28,28,248,22,175,13,23,196,2,10,28,248,22,174,13,23,196, +2,10,28,248,22,175,6,23,196,2,28,248,22,132,14,23,196,2,10,248,22, +133,14,23,196,2,11,12,252,22,151,9,2,11,2,26,36,23,200,2,23,201, +2,28,28,248,22,175,6,23,197,2,10,248,22,163,7,23,197,2,12,252,22, +151,9,2,11,2,27,37,23,200,2,23,201,2,91,159,39,11,90,161,39,36, +11,248,22,131,14,23,199,2,87,94,23,195,1,87,94,28,192,12,250,22,152, +9,2,11,2,28,23,201,2,249,22,7,194,195,27,249,22,184,13,249,22,173, +7,250,22,173,14,0,9,35,114,120,35,34,91,46,93,34,248,22,180,13,23, +203,1,6,1,1,95,28,248,22,175,6,23,202,2,249,22,187,7,23,203,1, +8,63,23,201,1,28,248,22,175,13,23,199,2,248,22,176,13,23,199,1,87, +94,23,198,1,247,22,177,13,28,248,22,174,13,194,249,22,128,14,195,194,192, +249,247,22,142,5,194,11,249,80,159,38,47,37,9,9,249,80,159,38,47,37, +195,9,27,247,22,154,14,249,80,158,39,48,28,23,195,2,27,248,22,128,8, 6,11,11,80,76,84,67,79,76,76,69,67,84,83,28,192,192,6,0,0,6, -0,0,27,28,23,196,1,250,22,188,13,248,22,146,14,69,97,100,100,111,110, -45,100,105,114,247,22,186,7,6,8,8,99,111,108,108,101,99,116,115,11,27, -248,80,159,42,53,37,250,22,85,23,203,1,248,22,81,248,22,146,14,72,99, +0,0,27,28,23,196,1,250,22,128,14,248,22,150,14,69,97,100,100,111,110, +45,100,105,114,247,22,190,7,6,8,8,99,111,108,108,101,99,116,115,11,27, +248,80,159,42,53,37,250,22,85,23,203,1,248,22,81,248,22,150,14,72,99, 111,108,108,101,99,116,115,45,100,105,114,23,204,1,28,193,249,22,71,195,194, -192,32,51,89,162,8,44,39,8,31,2,19,222,33,52,27,249,22,157,14,23, +192,32,51,89,162,8,44,39,8,31,2,19,222,33,52,27,249,22,161,14,23, 197,2,23,198,2,28,23,193,2,87,94,23,196,1,27,248,22,96,23,195,2, -27,27,248,22,105,23,197,1,27,249,22,157,14,23,201,2,23,196,2,28,23, +27,27,248,22,105,23,197,1,27,249,22,161,14,23,201,2,23,196,2,28,23, 193,2,87,94,23,194,1,27,248,22,96,23,195,2,27,27,248,22,105,23,197, -1,27,249,22,157,14,23,205,2,23,196,2,28,23,193,2,87,94,23,194,1, -27,248,22,96,23,195,2,27,27,248,22,105,23,197,1,27,249,22,157,14,23, +1,27,249,22,161,14,23,205,2,23,196,2,28,23,193,2,87,94,23,194,1, +27,248,22,96,23,195,2,27,27,248,22,105,23,197,1,27,249,22,161,14,23, 209,2,23,196,2,28,23,193,2,87,94,23,194,1,27,248,22,96,23,195,2, -27,27,248,22,105,23,197,1,27,249,22,157,14,23,213,2,23,196,2,28,23, +27,27,248,22,105,23,197,1,27,249,22,161,14,23,213,2,23,196,2,28,23, 193,2,87,94,23,194,1,27,248,22,96,23,195,2,27,250,2,51,23,215,2, -23,216,1,248,22,105,23,199,1,28,249,22,165,7,23,196,2,2,29,249,22, -85,23,214,2,194,249,22,71,248,22,179,13,23,197,1,194,87,95,23,211,1, -23,193,1,28,249,22,165,7,23,196,2,2,29,249,22,85,23,212,2,9,249, -22,71,248,22,179,13,23,197,1,9,28,249,22,165,7,23,196,2,2,29,249, -22,85,23,210,2,194,249,22,71,248,22,179,13,23,197,1,194,87,94,23,193, -1,28,249,22,165,7,23,196,2,2,29,249,22,85,23,208,2,9,249,22,71, -248,22,179,13,23,197,1,9,28,249,22,165,7,23,196,2,2,29,249,22,85, -23,206,2,194,249,22,71,248,22,179,13,23,197,1,194,87,94,23,193,1,28, -249,22,165,7,23,196,2,2,29,249,22,85,23,204,2,9,249,22,71,248,22, -179,13,23,197,1,9,28,249,22,165,7,23,196,2,2,29,249,22,85,23,202, -2,194,249,22,71,248,22,179,13,23,197,1,194,87,94,23,193,1,28,249,22, -165,7,23,196,2,2,29,249,22,85,23,200,2,9,249,22,71,248,22,179,13, -23,197,1,9,28,249,22,165,7,23,196,2,2,29,249,22,85,197,194,87,94, -23,196,1,249,22,71,248,22,179,13,23,197,1,194,87,94,23,193,1,28,249, -22,165,7,23,198,2,2,29,249,22,85,195,9,87,94,23,194,1,249,22,71, -248,22,179,13,23,199,1,9,87,95,28,28,248,22,159,7,194,10,248,22,171, -6,194,12,250,22,147,9,2,14,6,21,21,98,121,116,101,32,115,116,114,105, +23,216,1,248,22,105,23,199,1,28,249,22,169,7,23,196,2,2,29,249,22, +85,23,214,2,194,249,22,71,248,22,183,13,23,197,1,194,87,95,23,211,1, +23,193,1,28,249,22,169,7,23,196,2,2,29,249,22,85,23,212,2,9,249, +22,71,248,22,183,13,23,197,1,9,28,249,22,169,7,23,196,2,2,29,249, +22,85,23,210,2,194,249,22,71,248,22,183,13,23,197,1,194,87,94,23,193, +1,28,249,22,169,7,23,196,2,2,29,249,22,85,23,208,2,9,249,22,71, +248,22,183,13,23,197,1,9,28,249,22,169,7,23,196,2,2,29,249,22,85, +23,206,2,194,249,22,71,248,22,183,13,23,197,1,194,87,94,23,193,1,28, +249,22,169,7,23,196,2,2,29,249,22,85,23,204,2,9,249,22,71,248,22, +183,13,23,197,1,9,28,249,22,169,7,23,196,2,2,29,249,22,85,23,202, +2,194,249,22,71,248,22,183,13,23,197,1,194,87,94,23,193,1,28,249,22, +169,7,23,196,2,2,29,249,22,85,23,200,2,9,249,22,71,248,22,183,13, +23,197,1,9,28,249,22,169,7,23,196,2,2,29,249,22,85,197,194,87,94, +23,196,1,249,22,71,248,22,183,13,23,197,1,194,87,94,23,193,1,28,249, +22,169,7,23,198,2,2,29,249,22,85,195,9,87,94,23,194,1,249,22,71, +248,22,183,13,23,199,1,9,87,95,28,28,248,22,163,7,194,10,248,22,175, +6,194,12,250,22,151,9,2,14,6,21,21,98,121,116,101,32,115,116,114,105, 110,103,32,111,114,32,115,116,114,105,110,103,196,28,28,248,22,80,195,249,22, -4,22,170,13,196,11,12,250,22,147,9,2,14,6,13,13,108,105,115,116,32, -111,102,32,112,97,116,104,115,197,250,2,51,197,195,28,248,22,171,6,197,248, -22,182,7,197,196,32,54,89,162,8,44,39,53,70,102,111,117,110,100,45,101, +4,22,174,13,196,11,12,250,22,151,9,2,14,6,13,13,108,105,115,116,32, +111,102,32,112,97,116,104,115,197,250,2,51,197,195,28,248,22,175,6,197,248, +22,186,7,197,196,32,54,89,162,8,44,39,53,70,102,111,117,110,100,45,101, 120,101,99,222,33,57,32,55,89,162,8,44,40,58,64,110,101,120,116,222,33, -56,27,248,22,132,14,23,196,2,28,249,22,179,8,23,195,2,23,197,1,11, -28,248,22,128,14,23,194,2,27,249,22,188,13,23,197,1,23,196,1,28,23, -197,2,91,159,39,11,90,161,39,36,11,248,22,191,13,23,197,2,87,95,23, -195,1,23,194,1,27,28,23,202,2,27,248,22,132,14,23,199,2,28,249,22, -179,8,23,195,2,23,200,2,11,28,248,22,128,14,23,194,2,250,2,54,23, -205,2,23,206,2,249,22,188,13,23,200,2,23,198,1,250,2,54,23,205,2, +56,27,248,22,136,14,23,196,2,28,249,22,183,8,23,195,2,23,197,1,11, +28,248,22,132,14,23,194,2,27,249,22,128,14,23,197,1,23,196,1,28,23, +197,2,91,159,39,11,90,161,39,36,11,248,22,131,14,23,197,2,87,95,23, +195,1,23,194,1,27,28,23,202,2,27,248,22,136,14,23,199,2,28,249,22, +183,8,23,195,2,23,200,2,11,28,248,22,132,14,23,194,2,250,2,54,23, +205,2,23,206,2,249,22,128,14,23,200,2,23,198,1,250,2,54,23,205,2, 23,206,2,23,196,1,11,28,23,193,2,192,87,94,23,193,1,27,28,248,22, -170,13,23,196,2,27,249,22,188,13,23,198,2,23,205,2,28,28,248,22,183, -13,193,10,248,22,182,13,193,192,11,11,28,23,193,2,192,87,94,23,193,1, -28,23,203,2,11,27,248,22,132,14,23,200,2,28,249,22,179,8,23,195,2, -23,201,1,11,28,248,22,128,14,23,194,2,250,2,54,23,206,1,23,207,1, -249,22,188,13,23,201,1,23,198,1,250,2,54,205,206,195,192,87,94,23,194, -1,28,23,196,2,91,159,39,11,90,161,39,36,11,248,22,191,13,23,197,2, -87,95,23,195,1,23,194,1,27,28,23,201,2,27,248,22,132,14,23,199,2, -28,249,22,179,8,23,195,2,23,200,2,11,28,248,22,128,14,23,194,2,250, -2,54,23,204,2,23,205,2,249,22,188,13,23,200,2,23,198,1,250,2,54, +174,13,23,196,2,27,249,22,128,14,23,198,2,23,205,2,28,28,248,22,187, +13,193,10,248,22,186,13,193,192,11,11,28,23,193,2,192,87,94,23,193,1, +28,23,203,2,11,27,248,22,136,14,23,200,2,28,249,22,183,8,23,195,2, +23,201,1,11,28,248,22,132,14,23,194,2,250,2,54,23,206,1,23,207,1, +249,22,128,14,23,201,1,23,198,1,250,2,54,205,206,195,192,87,94,23,194, +1,28,23,196,2,91,159,39,11,90,161,39,36,11,248,22,131,14,23,197,2, +87,95,23,195,1,23,194,1,27,28,23,201,2,27,248,22,136,14,23,199,2, +28,249,22,183,8,23,195,2,23,200,2,11,28,248,22,132,14,23,194,2,250, +2,54,23,204,2,23,205,2,249,22,128,14,23,200,2,23,198,1,250,2,54, 23,204,2,23,205,2,23,196,1,11,28,23,193,2,192,87,94,23,193,1,27, -28,248,22,170,13,23,196,2,27,249,22,188,13,23,198,2,23,204,2,28,28, -248,22,183,13,193,10,248,22,182,13,193,192,11,11,28,23,193,2,192,87,94, -23,193,1,28,23,202,2,11,27,248,22,132,14,23,200,2,28,249,22,179,8, -23,195,2,23,201,1,11,28,248,22,128,14,23,194,2,250,2,54,23,205,1, -23,206,1,249,22,188,13,23,201,1,23,198,1,250,2,54,204,205,195,192,28, -23,193,2,91,159,39,11,90,161,39,36,11,248,22,191,13,23,199,2,87,95, +28,248,22,174,13,23,196,2,27,249,22,128,14,23,198,2,23,204,2,28,28, +248,22,187,13,193,10,248,22,186,13,193,192,11,11,28,23,193,2,192,87,94, +23,193,1,28,23,202,2,11,27,248,22,136,14,23,200,2,28,249,22,183,8, +23,195,2,23,201,1,11,28,248,22,132,14,23,194,2,250,2,54,23,205,1, +23,206,1,249,22,128,14,23,201,1,23,198,1,250,2,54,204,205,195,192,28, +23,193,2,91,159,39,11,90,161,39,36,11,248,22,131,14,23,199,2,87,95, 23,195,1,23,194,1,27,28,23,198,2,251,2,55,23,198,2,23,203,2,23, -201,2,23,202,2,11,28,23,193,2,192,87,94,23,193,1,27,28,248,22,170, -13,195,27,249,22,188,13,197,200,28,28,248,22,183,13,193,10,248,22,182,13, +201,2,23,202,2,11,28,23,193,2,192,87,94,23,193,1,27,28,248,22,174, +13,195,27,249,22,128,14,197,200,28,28,248,22,187,13,193,10,248,22,186,13, 193,192,11,11,28,192,192,28,198,11,251,2,55,198,203,201,202,194,32,58,89, 162,8,44,40,8,31,2,19,222,33,59,28,248,22,79,23,197,2,11,27,248, -22,131,14,248,22,72,23,199,2,27,249,22,188,13,23,196,1,23,197,2,28, -248,22,182,13,23,194,2,250,2,54,198,199,195,87,94,23,193,1,27,248,22, -73,23,200,1,28,248,22,79,23,194,2,11,27,248,22,131,14,248,22,72,23, -196,2,27,249,22,188,13,23,196,1,23,200,2,28,248,22,182,13,23,194,2, +22,135,14,248,22,72,23,199,2,27,249,22,128,14,23,196,1,23,197,2,28, +248,22,186,13,23,194,2,250,2,54,198,199,195,87,94,23,193,1,27,248,22, +73,23,200,1,28,248,22,79,23,194,2,11,27,248,22,135,14,248,22,72,23, +196,2,27,249,22,128,14,23,196,1,23,200,2,28,248,22,186,13,23,194,2, 250,2,54,201,202,195,87,94,23,193,1,27,248,22,73,23,197,1,28,248,22, -79,23,194,2,11,27,248,22,131,14,248,22,72,23,196,2,27,249,22,188,13, -23,196,1,23,203,2,28,248,22,182,13,23,194,2,250,2,54,204,205,195,87, +79,23,194,2,11,27,248,22,135,14,248,22,72,23,196,2,27,249,22,128,14, +23,196,1,23,203,2,28,248,22,186,13,23,194,2,250,2,54,204,205,195,87, 94,23,193,1,27,248,22,73,23,197,1,28,248,22,79,23,194,2,11,27,248, -22,131,14,248,22,72,23,196,2,27,249,22,188,13,23,196,1,23,206,2,28, -248,22,182,13,23,194,2,250,2,54,23,15,23,16,195,87,94,23,193,1,27, -248,22,73,23,197,1,28,248,22,79,23,194,2,11,27,248,22,131,14,248,22, -72,23,196,2,27,249,22,188,13,23,196,1,23,209,2,28,248,22,182,13,23, +22,135,14,248,22,72,23,196,2,27,249,22,128,14,23,196,1,23,206,2,28, +248,22,186,13,23,194,2,250,2,54,23,15,23,16,195,87,94,23,193,1,27, +248,22,73,23,197,1,28,248,22,79,23,194,2,11,27,248,22,135,14,248,22, +72,23,196,2,27,249,22,128,14,23,196,1,23,209,2,28,248,22,186,13,23, 194,2,250,2,54,23,18,23,19,195,87,94,23,193,1,27,248,22,73,23,197, -1,28,248,22,79,23,194,2,11,27,248,22,131,14,248,22,72,195,27,249,22, -188,13,23,196,1,23,19,28,248,22,182,13,193,250,2,54,23,21,23,22,195, -251,2,58,23,21,23,22,23,23,248,22,73,199,87,95,28,28,248,22,170,13, -23,195,2,10,28,248,22,171,6,23,195,2,28,248,22,128,14,23,195,2,10, -248,22,129,14,23,195,2,11,12,250,22,147,9,2,15,6,25,25,112,97,116, +1,28,248,22,79,23,194,2,11,27,248,22,135,14,248,22,72,195,27,249,22, +128,14,23,196,1,23,19,28,248,22,186,13,193,250,2,54,23,21,23,22,195, +251,2,58,23,21,23,22,23,23,248,22,73,199,87,95,28,28,248,22,174,13, +23,195,2,10,28,248,22,175,6,23,195,2,28,248,22,132,14,23,195,2,10, +248,22,133,14,23,195,2,11,12,250,22,151,9,2,15,6,25,25,112,97,116, 104,32,111,114,32,115,116,114,105,110,103,32,40,115,97,110,115,32,110,117,108, -41,23,197,2,28,28,23,195,2,28,28,248,22,170,13,23,196,2,10,28,248, -22,171,6,23,196,2,28,248,22,128,14,23,196,2,10,248,22,129,14,23,196, -2,11,248,22,128,14,23,196,2,11,10,12,250,22,147,9,2,15,6,29,29, +41,23,197,2,28,28,23,195,2,28,28,248,22,174,13,23,196,2,10,28,248, +22,175,6,23,196,2,28,248,22,132,14,23,196,2,10,248,22,133,14,23,196, +2,11,248,22,132,14,23,196,2,11,10,12,250,22,151,9,2,15,6,29,29, 35,102,32,111,114,32,114,101,108,97,116,105,118,101,32,112,97,116,104,32,111, -114,32,115,116,114,105,110,103,23,198,2,28,28,248,22,128,14,23,195,2,91, -159,39,11,90,161,39,36,11,248,22,191,13,23,198,2,249,22,177,8,194,68, -114,101,108,97,116,105,118,101,11,27,248,22,188,7,6,4,4,80,65,84,72, -27,28,23,194,2,27,249,80,159,41,48,38,23,197,1,9,28,249,22,177,8, -247,22,190,7,2,21,249,22,71,248,22,179,13,5,1,46,194,192,87,94,23, -194,1,9,28,248,22,79,23,194,2,11,27,248,22,131,14,248,22,72,23,196, -2,27,249,22,188,13,23,196,1,23,200,2,28,248,22,182,13,23,194,2,250, +114,32,115,116,114,105,110,103,23,198,2,28,28,248,22,132,14,23,195,2,91, +159,39,11,90,161,39,36,11,248,22,131,14,23,198,2,249,22,181,8,194,68, +114,101,108,97,116,105,118,101,11,27,248,22,128,8,6,4,4,80,65,84,72, +27,28,23,194,2,27,249,80,159,41,48,38,23,197,1,9,28,249,22,181,8, +247,22,130,8,2,21,249,22,71,248,22,183,13,5,1,46,194,192,87,94,23, +194,1,9,28,248,22,79,23,194,2,11,27,248,22,135,14,248,22,72,23,196, +2,27,249,22,128,14,23,196,1,23,200,2,28,248,22,186,13,23,194,2,250, 2,54,201,202,195,87,94,23,193,1,27,248,22,73,23,197,1,28,248,22,79, -23,194,2,11,27,248,22,131,14,248,22,72,23,196,2,27,249,22,188,13,23, -196,1,23,203,2,28,248,22,182,13,23,194,2,250,2,54,204,205,195,87,94, +23,194,2,11,27,248,22,135,14,248,22,72,23,196,2,27,249,22,128,14,23, +196,1,23,203,2,28,248,22,186,13,23,194,2,250,2,54,204,205,195,87,94, 23,193,1,27,248,22,73,23,197,1,28,248,22,79,23,194,2,11,27,248,22, -131,14,248,22,72,195,27,249,22,188,13,23,196,1,205,28,248,22,182,13,193, +135,14,248,22,72,195,27,249,22,128,14,23,196,1,205,28,248,22,186,13,193, 250,2,54,23,15,23,16,195,251,2,58,23,15,23,16,23,17,248,22,73,199, -27,248,22,131,14,23,196,1,28,248,22,182,13,193,250,2,54,198,199,195,11, +27,248,22,135,14,23,196,1,28,248,22,186,13,193,250,2,54,198,199,195,11, 250,80,159,39,49,37,196,197,11,250,80,159,39,49,37,196,11,11,87,94,249, -22,162,6,247,22,134,5,195,248,22,188,5,249,22,180,3,36,249,22,164,3, +22,166,6,247,22,138,5,195,248,22,128,6,249,22,184,3,36,249,22,168,3, 197,198,27,28,23,197,2,87,95,23,196,1,23,195,1,23,197,1,87,94,23, -197,1,27,248,22,146,14,2,20,27,249,80,159,41,49,37,23,196,1,11,27, -27,248,22,183,3,23,200,1,28,192,192,36,27,27,248,22,183,3,23,202,1, -28,192,192,36,249,22,165,5,23,197,1,83,158,40,20,100,95,89,162,8,44, -36,48,9,224,3,2,33,63,23,195,1,23,196,1,27,248,22,150,5,23,195, +197,1,27,248,22,150,14,2,20,27,249,80,159,41,49,37,23,196,1,11,27, +27,248,22,187,3,23,200,1,28,192,192,36,27,27,248,22,187,3,23,202,1, +28,192,192,36,249,22,169,5,23,197,1,83,158,40,20,100,95,89,162,8,44, +36,48,9,224,3,2,33,63,23,195,1,23,196,1,27,248,22,154,5,23,195, 1,248,80,159,39,54,37,193,159,36,20,105,159,36,16,1,11,16,0,83,158, 42,20,103,145,2,1,2,1,29,11,11,11,11,11,10,43,80,158,36,36,20, 105,159,38,16,17,2,2,2,3,2,4,2,5,2,6,2,7,2,8,2,9, @@ -375,7 +375,7 @@ 16,2,89,162,8,44,37,51,2,19,223,0,33,30,80,159,36,54,37,83,158, 36,16,2,89,162,8,44,37,56,2,19,223,0,33,31,80,159,36,53,37,83, 158,36,16,2,32,0,89,162,44,37,45,2,2,222,33,32,80,159,36,36,37, -83,158,36,16,2,249,22,173,6,7,92,7,92,80,159,36,37,37,83,158,36, +83,158,36,16,2,249,22,177,6,7,92,7,92,80,159,36,37,37,83,158,36, 16,2,89,162,44,37,54,2,4,223,0,33,33,80,159,36,38,37,83,158,36, 16,2,32,0,89,162,8,44,38,50,2,5,222,33,34,80,159,36,39,37,83, 158,36,16,2,32,0,89,162,8,44,39,51,2,6,222,33,36,80,159,36,40, @@ -388,8 +388,8 @@ 222,33,47,80,159,36,46,37,83,158,36,16,2,83,158,39,20,99,96,2,13, 89,162,44,36,44,9,223,0,33,48,89,162,44,37,45,9,223,0,33,49,89, 162,44,38,55,9,223,0,33,50,80,159,36,47,37,83,158,36,16,2,27,248, -22,153,14,248,22,182,7,27,28,249,22,177,8,247,22,190,7,2,21,6,1, -1,59,6,1,1,58,250,22,155,7,6,14,14,40,91,94,126,97,93,42,41, +22,157,14,248,22,186,7,27,28,249,22,181,8,247,22,130,8,2,21,6,1, +1,59,6,1,1,58,250,22,159,7,6,14,14,40,91,94,126,97,93,42,41, 126,97,40,46,42,41,23,196,2,23,196,1,89,162,8,44,38,48,2,14,223, 0,33,53,80,159,36,48,37,83,158,36,16,2,83,158,39,20,99,96,2,15, 89,162,8,44,39,8,24,9,223,0,33,60,89,162,44,38,47,9,223,0,33, @@ -400,13 +400,13 @@ EVAL_ONE_SIZED_STR((char *)expr, 6246); } { - SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,8,52,46,50,46,53,46,49,48,9,0,0,0,1,0,0,10,0,16, + SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,8,52,46,50,46,53,46,49,49,9,0,0,0,1,0,0,10,0,16, 0,29,0,44,0,58,0,72,0,86,0,128,0,0,0,57,1,0,0,69,35, 37,98,117,105,108,116,105,110,65,113,117,111,116,101,29,94,2,2,67,35,37, 117,116,105,108,115,11,29,94,2,2,69,35,37,110,101,116,119,111,114,107,11, 29,94,2,2,68,35,37,112,97,114,97,109,122,11,29,94,2,2,68,35,37, 101,120,112,111,98,115,11,29,94,2,2,68,35,37,107,101,114,110,101,108,11, -97,36,11,8,240,215,77,0,0,98,159,2,3,36,36,159,2,4,36,36,159, +97,36,11,8,240,33,79,0,0,98,159,2,3,36,36,159,2,4,36,36,159, 2,5,36,36,159,2,6,36,36,159,2,7,36,36,159,2,7,36,36,16,0, 159,36,20,105,159,36,16,1,11,16,0,83,158,42,20,103,145,2,1,2,1, 29,11,11,11,11,11,18,96,11,44,44,44,36,80,158,36,36,20,105,159,36, @@ -420,7 +420,7 @@ EVAL_ONE_SIZED_STR((char *)expr, 353); } { - SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,8,52,46,50,46,53,46,49,48,74,0,0,0,1,0,0,7,0,18, + SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,8,52,46,50,46,53,46,49,49,74,0,0,0,1,0,0,7,0,18, 0,45,0,51,0,64,0,73,0,80,0,102,0,124,0,150,0,162,0,180,0, 200,0,212,0,228,0,251,0,7,1,38,1,45,1,50,1,55,1,60,1,65, 1,70,1,79,1,84,1,88,1,94,1,101,1,107,1,115,1,124,1,145,1, @@ -446,97 +446,97 @@ 97,109,101,5,3,46,122,111,5,3,46,122,111,6,6,6,110,97,116,105,118, 101,64,108,111,111,112,63,108,105,98,6,3,3,46,115,115,6,4,4,46,114, 107,116,5,4,46,114,107,116,67,105,103,110,111,114,101,100,249,22,14,195,80, -159,38,46,38,250,22,188,13,23,197,1,23,199,1,249,80,159,43,39,38,23, -198,1,2,23,250,22,188,13,23,197,1,23,199,1,249,80,159,43,39,38,23, -198,1,2,24,252,22,188,13,23,199,1,23,201,1,2,25,247,22,191,7,249, -80,159,45,39,38,23,200,1,80,159,45,36,38,252,22,188,13,23,199,1,23, -201,1,2,25,247,22,191,7,249,80,159,45,39,38,23,200,1,80,159,45,36, -38,27,252,22,188,13,23,200,1,23,202,1,2,25,247,22,191,7,249,80,159, -46,39,38,23,201,1,80,159,46,36,38,27,250,22,141,14,196,11,32,0,89, -162,8,44,36,41,9,222,11,28,192,249,22,71,195,194,11,27,252,22,188,13, -23,200,1,23,202,1,2,25,247,22,191,7,249,80,159,46,39,38,23,201,1, -80,159,46,36,38,27,250,22,141,14,196,11,32,0,89,162,8,44,36,41,9, -222,11,28,192,249,22,71,195,194,11,27,250,22,188,13,23,198,1,23,200,1, -249,80,159,44,39,38,23,199,1,2,23,27,250,22,141,14,196,11,32,0,89, -162,8,44,36,41,9,222,11,28,192,249,22,71,195,194,11,27,250,22,188,13, -23,198,1,23,200,1,249,80,159,44,39,38,23,199,1,2,24,27,250,22,141, +159,38,46,38,250,22,128,14,23,197,1,23,199,1,249,80,159,43,39,38,23, +198,1,2,23,250,22,128,14,23,197,1,23,199,1,249,80,159,43,39,38,23, +198,1,2,24,252,22,128,14,23,199,1,23,201,1,2,25,247,22,131,8,249, +80,159,45,39,38,23,200,1,80,159,45,36,38,252,22,128,14,23,199,1,23, +201,1,2,25,247,22,131,8,249,80,159,45,39,38,23,200,1,80,159,45,36, +38,27,252,22,128,14,23,200,1,23,202,1,2,25,247,22,131,8,249,80,159, +46,39,38,23,201,1,80,159,46,36,38,27,250,22,145,14,196,11,32,0,89, +162,8,44,36,41,9,222,11,28,192,249,22,71,195,194,11,27,252,22,128,14, +23,200,1,23,202,1,2,25,247,22,131,8,249,80,159,46,39,38,23,201,1, +80,159,46,36,38,27,250,22,145,14,196,11,32,0,89,162,8,44,36,41,9, +222,11,28,192,249,22,71,195,194,11,27,250,22,128,14,23,198,1,23,200,1, +249,80,159,44,39,38,23,199,1,2,23,27,250,22,145,14,196,11,32,0,89, +162,8,44,36,41,9,222,11,28,192,249,22,71,195,194,11,27,250,22,128,14, +23,198,1,23,200,1,249,80,159,44,39,38,23,199,1,2,24,27,250,22,145, 14,196,11,32,0,89,162,8,44,36,41,9,222,11,28,192,249,22,71,195,194, -11,87,94,28,248,80,159,37,38,38,23,195,2,12,250,22,147,9,77,108,111, +11,87,94,28,248,80,159,37,38,38,23,195,2,12,250,22,151,9,77,108,111, 97,100,47,117,115,101,45,99,111,109,112,105,108,101,100,6,25,25,112,97,116, 104,32,111,114,32,118,97,108,105,100,45,112,97,116,104,32,115,116,114,105,110, -103,23,197,2,91,159,46,11,90,161,37,36,11,28,248,22,130,14,23,205,2, -23,204,2,27,247,22,139,5,28,23,193,2,249,22,131,14,23,207,2,23,195, -1,23,205,2,90,161,39,37,11,248,22,191,13,23,205,1,87,94,23,196,1, -90,161,38,40,11,28,23,205,2,27,248,22,175,13,23,197,2,27,248,22,162, -7,23,195,2,28,28,249,22,176,3,23,195,2,40,249,22,165,7,5,4,46, -114,107,116,249,22,168,7,23,198,2,249,22,164,3,23,199,2,40,11,249,22, -7,23,199,2,248,22,179,13,249,22,169,7,250,22,168,7,23,202,1,36,249, -22,164,3,23,203,1,40,5,3,46,115,115,249,22,7,23,199,2,11,249,22, -7,23,197,2,11,90,161,37,42,11,28,249,22,177,8,23,199,2,23,197,2, -23,193,2,249,22,188,13,23,196,2,23,199,2,90,161,37,43,11,28,23,198, -2,28,249,22,177,8,23,200,2,23,197,1,23,193,1,87,94,23,193,1,249, -22,188,13,23,196,2,23,200,2,87,94,23,195,1,11,90,161,37,44,11,28, -249,22,177,8,23,196,2,68,114,101,108,97,116,105,118,101,87,94,23,194,1, -2,22,23,194,1,90,161,37,45,11,247,22,149,14,27,27,250,22,141,14,23, +103,23,197,2,91,159,46,11,90,161,37,36,11,28,248,22,134,14,23,205,2, +23,204,2,27,247,22,143,5,28,23,193,2,249,22,135,14,23,207,2,23,195, +1,23,205,2,90,161,39,37,11,248,22,131,14,23,205,1,87,94,23,196,1, +90,161,38,40,11,28,23,205,2,27,248,22,179,13,23,197,2,27,248,22,166, +7,23,195,2,28,28,249,22,180,3,23,195,2,40,249,22,169,7,5,4,46, +114,107,116,249,22,172,7,23,198,2,249,22,168,3,23,199,2,40,11,249,22, +7,23,199,2,248,22,183,13,249,22,173,7,250,22,172,7,23,202,1,36,249, +22,168,3,23,203,1,40,5,3,46,115,115,249,22,7,23,199,2,11,249,22, +7,23,197,2,11,90,161,37,42,11,28,249,22,181,8,23,199,2,23,197,2, +23,193,2,249,22,128,14,23,196,2,23,199,2,90,161,37,43,11,28,23,198, +2,28,249,22,181,8,23,200,2,23,197,1,23,193,1,87,94,23,193,1,249, +22,128,14,23,196,2,23,200,2,87,94,23,195,1,11,90,161,37,44,11,28, +249,22,181,8,23,196,2,68,114,101,108,97,116,105,118,101,87,94,23,194,1, +2,22,23,194,1,90,161,37,45,11,247,22,153,14,27,27,250,22,145,14,23, 204,2,11,32,0,89,162,8,44,36,41,9,222,11,28,192,249,22,71,23,203, -2,194,11,27,28,23,202,2,28,23,194,2,11,27,250,22,141,14,23,206,2, +2,194,11,27,28,23,202,2,28,23,194,2,11,27,250,22,145,14,23,206,2, 11,32,0,89,162,8,44,36,41,9,222,11,28,192,249,22,71,23,205,2,194, 11,11,27,28,23,195,2,23,195,2,23,194,2,27,89,162,44,37,50,62,122, 111,225,14,12,8,33,33,27,89,162,44,37,50,66,97,108,116,45,122,111,225, 15,13,10,33,34,27,89,162,44,37,52,9,225,16,14,10,33,35,27,89,162, -44,37,52,9,225,17,15,12,33,36,27,28,23,200,2,23,200,2,248,22,175, +44,37,52,9,225,17,15,12,33,36,27,28,23,200,2,23,200,2,248,22,179, 8,23,200,2,27,28,23,207,2,28,23,200,2,87,94,23,201,1,23,200,2, -248,22,175,8,23,202,1,11,27,28,23,195,2,28,23,197,1,27,249,22,5, +248,22,179,8,23,202,1,11,27,28,23,195,2,28,23,197,1,27,249,22,5, 89,162,8,44,37,53,9,225,23,21,17,33,37,23,215,2,27,28,23,202,2, -11,193,28,192,192,28,193,28,23,202,2,28,249,22,176,3,248,22,73,196,248, +11,193,28,192,192,28,193,28,23,202,2,28,249,22,180,3,248,22,73,196,248, 22,73,23,205,2,193,11,11,11,11,87,94,23,197,1,11,28,23,193,2,87, 105,23,212,1,23,210,1,23,209,1,23,208,1,23,207,1,23,201,1,23,200, 1,23,199,1,23,198,1,23,196,1,23,195,1,23,194,1,20,14,159,80,159, -56,40,38,250,80,159,59,41,38,249,22,27,11,80,159,8,25,40,38,22,163, +56,40,38,250,80,159,59,41,38,249,22,27,11,80,159,8,25,40,38,22,167, 4,11,20,14,159,80,159,56,40,38,250,80,159,59,41,38,249,22,27,11,80, -159,8,25,40,38,22,139,5,28,248,22,170,13,23,215,2,23,214,1,87,94, -23,214,1,247,22,147,14,249,247,22,152,14,248,22,72,195,23,24,87,94,23, +159,8,25,40,38,22,143,5,28,248,22,174,13,23,215,2,23,214,1,87,94, +23,214,1,247,22,151,14,249,247,22,156,14,248,22,72,195,23,24,87,94,23, 193,1,27,28,23,195,2,28,23,197,1,27,249,22,5,89,162,8,44,37,53, 9,225,24,22,19,33,38,23,216,2,27,28,23,204,2,11,193,28,192,192,28, -193,28,203,28,249,22,176,3,248,22,73,196,248,22,73,206,193,11,11,11,11, +193,28,203,28,249,22,180,3,248,22,73,196,248,22,73,206,193,11,11,11,11, 87,94,23,197,1,11,28,23,193,2,87,102,23,213,1,23,210,1,23,209,1, 23,208,1,23,201,1,23,200,1,23,199,1,23,196,1,23,195,1,20,14,159, 80,159,57,40,38,250,80,159,8,24,41,38,249,22,27,11,80,159,8,26,40, -38,22,163,4,23,214,1,20,14,159,80,159,57,40,38,250,80,159,8,24,41, -38,249,22,27,11,80,159,8,26,40,38,22,139,5,28,248,22,170,13,23,216, -2,23,215,1,87,94,23,215,1,247,22,147,14,249,247,22,152,14,248,22,72, +38,22,167,4,23,214,1,20,14,159,80,159,57,40,38,250,80,159,8,24,41, +38,249,22,27,11,80,159,8,26,40,38,22,143,5,28,248,22,174,13,23,216, +2,23,215,1,87,94,23,215,1,247,22,151,14,249,247,22,156,14,248,22,72, 195,23,25,87,94,23,193,1,27,28,23,197,2,28,23,201,1,27,249,22,5, 83,158,40,20,100,94,89,162,8,44,37,51,9,225,25,23,19,33,39,23,212, 1,23,217,2,27,28,23,204,2,11,193,28,192,192,28,193,28,23,204,2,28, -249,22,176,3,248,22,73,196,248,22,73,23,207,2,193,11,11,11,87,94,23, +249,22,180,3,248,22,73,196,248,22,73,23,207,2,193,11,11,11,87,94,23, 209,1,11,87,94,23,201,1,11,28,23,193,2,87,101,23,214,1,23,212,1, 23,211,1,23,210,1,23,202,1,23,200,1,23,197,1,23,196,1,20,14,159, 80,159,58,40,38,250,80,159,8,25,41,38,249,22,27,11,80,159,8,27,40, -38,22,163,4,11,20,14,159,80,159,58,40,38,250,80,159,8,25,41,38,249, -22,27,11,80,159,8,27,40,38,22,139,5,28,248,22,170,13,23,217,2,23, -216,1,87,94,23,216,1,247,22,147,14,249,247,22,137,5,248,22,72,195,23, +38,22,167,4,11,20,14,159,80,159,58,40,38,250,80,159,8,25,41,38,249, +22,27,11,80,159,8,27,40,38,22,143,5,28,248,22,174,13,23,217,2,23, +216,1,87,94,23,216,1,247,22,151,14,249,247,22,141,5,248,22,72,195,23, 26,87,94,23,193,1,27,28,23,197,1,28,23,201,1,27,249,22,5,83,158, 40,20,100,94,89,162,8,44,37,51,9,225,26,24,21,33,40,23,214,1,23, -218,1,27,28,23,205,2,11,193,28,192,192,28,193,28,204,28,249,22,176,3, +218,1,27,28,23,205,2,11,193,28,192,192,28,193,28,204,28,249,22,180,3, 248,22,73,196,248,22,73,23,15,193,11,11,11,87,95,23,215,1,23,211,1, 11,87,94,23,201,1,11,28,23,193,2,87,95,23,212,1,23,198,1,20,14, 159,80,159,59,40,38,250,80,159,8,26,41,38,249,22,27,11,80,159,8,28, -40,38,22,163,4,23,216,1,20,14,159,80,159,59,40,38,250,80,159,8,26, -41,38,249,22,27,11,80,159,8,28,40,38,22,139,5,28,248,22,170,13,23, -218,2,23,217,1,87,94,23,217,1,247,22,147,14,249,247,22,137,5,248,22, +40,38,22,167,4,23,216,1,20,14,159,80,159,59,40,38,250,80,159,8,26, +41,38,249,22,27,11,80,159,8,28,40,38,22,143,5,28,248,22,174,13,23, +218,2,23,217,1,87,94,23,217,1,247,22,151,14,249,247,22,141,5,248,22, 72,195,23,27,87,94,23,193,1,27,28,23,199,2,87,94,23,214,1,23,213, 1,87,94,23,213,1,23,214,1,20,14,159,80,159,8,24,40,38,250,80,159, -8,27,41,38,249,22,27,11,80,159,8,29,40,38,22,163,4,28,23,29,28, +8,27,41,38,249,22,27,11,80,159,8,29,40,38,22,167,4,28,23,29,28, 23,202,1,11,195,87,94,23,202,1,11,20,14,159,80,159,8,24,40,38,250, -80,159,8,27,41,38,249,22,27,11,80,159,8,29,40,38,22,139,5,28,248, -22,170,13,23,219,2,23,218,1,87,94,23,218,1,247,22,147,14,249,247,22, -137,5,194,23,28,0,17,35,114,120,34,94,40,46,42,63,41,47,40,46,42, -41,36,34,32,43,89,162,8,44,37,59,2,26,222,33,44,27,249,22,157,14, +80,159,8,27,41,38,249,22,27,11,80,159,8,29,40,38,22,143,5,28,248, +22,174,13,23,219,2,23,218,1,87,94,23,218,1,247,22,151,14,249,247,22, +141,5,194,23,28,0,17,35,114,120,34,94,40,46,42,63,41,47,40,46,42, +41,36,34,32,43,89,162,8,44,37,59,2,26,222,33,44,27,249,22,161,14, 2,42,23,196,2,28,23,193,2,87,94,23,194,1,249,22,71,248,22,96,23, -196,2,27,248,22,105,23,197,1,27,249,22,157,14,2,42,23,196,2,28,23, +196,2,27,248,22,105,23,197,1,27,249,22,161,14,2,42,23,196,2,28,23, 193,2,87,94,23,194,1,249,22,71,248,22,96,23,196,2,27,248,22,105,23, -197,1,27,249,22,157,14,2,42,23,196,2,28,23,193,2,87,94,23,194,1, -249,22,71,248,22,96,23,196,2,27,248,22,105,23,197,1,27,249,22,157,14, +197,1,27,249,22,161,14,2,42,23,196,2,28,23,193,2,87,94,23,194,1, +249,22,71,248,22,96,23,196,2,27,248,22,105,23,197,1,27,249,22,161,14, 2,42,23,196,2,28,23,193,2,87,94,23,194,1,249,22,71,248,22,96,23, 196,2,248,2,43,248,22,105,23,197,1,248,22,81,194,248,22,81,194,248,22, 81,194,248,22,81,194,32,45,89,162,44,37,55,2,26,222,33,46,28,248,22, @@ -546,12 +546,12 @@ 22,79,248,22,73,23,195,2,249,22,7,9,248,22,72,195,91,159,38,11,90, 161,38,36,11,248,2,45,248,22,73,196,249,22,7,249,22,71,248,22,72,199, 196,195,249,22,7,249,22,71,248,22,72,199,196,195,249,22,7,249,22,71,248, -22,72,199,196,195,27,27,249,22,157,14,2,42,23,197,2,28,23,193,2,87, +22,72,199,196,195,27,27,249,22,161,14,2,42,23,197,2,28,23,193,2,87, 94,23,195,1,249,22,71,248,22,96,23,196,2,27,248,22,105,23,197,1,27, -249,22,157,14,2,42,23,196,2,28,23,193,2,87,94,23,194,1,249,22,71, -248,22,96,23,196,2,27,248,22,105,23,197,1,27,249,22,157,14,2,42,23, +249,22,161,14,2,42,23,196,2,28,23,193,2,87,94,23,194,1,249,22,71, +248,22,96,23,196,2,27,248,22,105,23,197,1,27,249,22,161,14,2,42,23, 196,2,28,23,193,2,87,94,23,194,1,249,22,71,248,22,96,23,196,2,27, -248,22,105,23,197,1,27,249,22,157,14,2,42,23,196,2,28,23,193,2,87, +248,22,105,23,197,1,27,249,22,161,14,2,42,23,196,2,28,23,193,2,87, 94,23,194,1,249,22,71,248,22,96,23,196,2,248,2,43,248,22,105,23,197, 1,248,22,81,194,248,22,81,194,248,22,81,194,248,22,81,195,28,23,195,1, 192,28,248,22,79,248,22,73,23,195,2,249,22,7,9,248,22,72,195,91,159, @@ -560,23 +560,23 @@ 73,196,28,248,22,79,248,22,73,23,195,2,249,22,7,9,248,22,72,195,91, 159,38,11,90,161,38,36,11,248,2,45,248,22,73,196,249,22,7,249,22,71, 248,22,72,199,196,195,249,22,7,249,22,71,248,22,72,199,196,195,249,22,7, -249,22,71,248,22,72,199,196,195,87,95,28,248,22,181,4,195,12,250,22,147, +249,22,71,248,22,72,199,196,195,87,95,28,248,22,185,4,195,12,250,22,151, 9,2,18,6,20,20,114,101,115,111,108,118,101,100,45,109,111,100,117,108,101, 45,112,97,116,104,197,28,24,193,2,248,24,194,1,195,87,94,23,193,1,12, -27,27,250,22,146,2,80,159,42,43,38,248,22,182,14,247,22,150,12,11,28, -23,193,2,192,87,94,23,193,1,27,247,22,130,2,87,94,250,22,144,2,80, -159,43,43,38,248,22,182,14,247,22,150,12,195,192,250,22,144,2,195,198,66, -97,116,116,97,99,104,251,211,197,198,199,10,28,192,250,22,146,9,11,196,195, -248,22,144,9,194,32,51,89,162,44,37,52,2,26,222,33,52,28,248,22,79, +27,27,250,22,150,2,80,159,42,43,38,248,22,186,14,247,22,154,12,11,28, +23,193,2,192,87,94,23,193,1,27,247,22,130,2,87,94,250,22,148,2,80, +159,43,43,38,248,22,186,14,247,22,154,12,195,192,250,22,148,2,195,198,66, +97,116,116,97,99,104,251,211,197,198,199,10,28,192,250,22,150,9,11,196,195, +248,22,148,9,194,32,51,89,162,44,37,52,2,26,222,33,52,28,248,22,79, 248,22,73,23,195,2,249,22,7,9,248,22,72,195,91,159,38,11,90,161,38, 36,11,27,248,22,73,196,28,248,22,79,248,22,73,23,195,2,249,22,7,9, 248,22,72,195,91,159,38,11,90,161,38,36,11,248,2,51,248,22,73,196,249, 22,7,249,22,71,248,22,72,199,196,195,249,22,7,249,22,71,248,22,72,199, -196,195,32,53,89,162,8,44,37,55,2,26,222,33,54,27,249,22,157,14,2, +196,195,32,53,89,162,8,44,37,55,2,26,222,33,54,27,249,22,161,14,2, 42,23,196,2,28,23,193,2,87,94,23,194,1,249,22,71,248,22,96,23,196, -2,27,248,22,105,23,197,1,27,249,22,157,14,2,42,23,196,2,28,23,193, +2,27,248,22,105,23,197,1,27,249,22,161,14,2,42,23,196,2,28,23,193, 2,87,94,23,194,1,249,22,71,248,22,96,23,196,2,27,248,22,105,23,197, -1,27,249,22,157,14,2,42,23,196,2,28,23,193,2,87,94,23,194,1,249, +1,27,249,22,161,14,2,42,23,196,2,28,23,193,2,87,94,23,194,1,249, 22,71,248,22,96,23,196,2,248,2,53,248,22,105,23,197,1,248,22,81,194, 248,22,81,194,248,22,81,194,32,55,89,162,44,37,52,2,26,222,33,56,28, 248,22,79,248,22,73,23,195,2,249,22,7,9,248,22,72,195,91,159,38,11, @@ -584,139 +584,139 @@ 22,7,9,248,22,72,195,91,159,38,11,90,161,38,36,11,248,2,55,248,22, 73,196,249,22,7,249,22,71,248,22,72,199,196,195,249,22,7,249,22,71,248, 22,72,199,196,195,32,57,89,162,8,44,37,55,2,26,222,33,58,27,249,22, -157,14,2,42,23,196,2,28,23,193,2,87,94,23,194,1,249,22,71,248,22, -96,23,196,2,27,248,22,105,23,197,1,27,249,22,157,14,2,42,23,196,2, +161,14,2,42,23,196,2,28,23,193,2,87,94,23,194,1,249,22,71,248,22, +96,23,196,2,27,248,22,105,23,197,1,27,249,22,161,14,2,42,23,196,2, 28,23,193,2,87,94,23,194,1,249,22,71,248,22,96,23,196,2,27,248,22, -105,23,197,1,27,249,22,157,14,2,42,23,196,2,28,23,193,2,87,94,23, +105,23,197,1,27,249,22,161,14,2,42,23,196,2,28,23,193,2,87,94,23, 194,1,249,22,71,248,22,96,23,196,2,248,2,57,248,22,105,23,197,1,248, -22,81,194,248,22,81,194,248,22,81,194,28,249,22,177,6,194,6,1,1,46, -2,22,28,249,22,177,6,194,6,2,2,46,46,62,117,112,192,0,11,35,114, +22,81,194,248,22,81,194,248,22,81,194,28,249,22,181,6,194,6,1,1,46, +2,22,28,249,22,181,6,194,6,2,2,46,46,62,117,112,192,0,11,35,114, 120,34,91,46,93,115,115,36,34,32,61,89,162,44,37,52,2,26,222,33,62, 28,248,22,79,248,22,73,23,195,2,249,22,7,9,248,22,72,195,91,159,38, 11,90,161,38,36,11,27,248,22,73,196,28,248,22,79,248,22,73,23,195,2, 249,22,7,9,248,22,72,195,91,159,38,11,90,161,38,36,11,248,2,61,248, 22,73,196,249,22,7,249,22,71,248,22,72,199,196,195,249,22,7,249,22,71, 248,22,72,199,196,195,32,63,89,162,8,44,37,55,2,26,222,33,64,27,249, -22,157,14,2,42,23,196,2,28,23,193,2,87,94,23,194,1,249,22,71,248, -22,96,23,196,2,27,248,22,105,23,197,1,27,249,22,157,14,2,42,23,196, +22,161,14,2,42,23,196,2,28,23,193,2,87,94,23,194,1,249,22,71,248, +22,96,23,196,2,27,248,22,105,23,197,1,27,249,22,161,14,2,42,23,196, 2,28,23,193,2,87,94,23,194,1,249,22,71,248,22,96,23,196,2,27,248, -22,105,23,197,1,27,249,22,157,14,2,42,23,196,2,28,23,193,2,87,94, +22,105,23,197,1,27,249,22,161,14,2,42,23,196,2,28,23,193,2,87,94, 23,194,1,249,22,71,248,22,96,23,196,2,248,2,63,248,22,105,23,197,1, 248,22,81,194,248,22,81,194,248,22,81,194,32,65,89,162,8,44,37,55,2, -26,222,33,66,27,249,22,157,14,2,42,23,196,2,28,23,193,2,87,94,23, +26,222,33,66,27,249,22,161,14,2,42,23,196,2,28,23,193,2,87,94,23, 194,1,249,22,71,248,22,96,23,196,2,27,248,22,105,23,197,1,27,249,22, -157,14,2,42,23,196,2,28,23,193,2,87,94,23,194,1,249,22,71,248,22, -96,23,196,2,27,248,22,105,23,197,1,27,249,22,157,14,2,42,23,196,2, +161,14,2,42,23,196,2,28,23,193,2,87,94,23,194,1,249,22,71,248,22, +96,23,196,2,27,248,22,105,23,197,1,27,249,22,161,14,2,42,23,196,2, 28,23,193,2,87,94,23,194,1,249,22,71,248,22,96,23,196,2,248,2,65, 248,22,105,23,197,1,248,22,81,194,248,22,81,194,248,22,81,194,27,248,2, -65,23,195,1,192,28,249,22,179,8,248,22,73,23,200,2,23,197,1,28,249, -22,177,8,248,22,72,23,200,2,23,196,1,251,22,144,9,2,18,6,26,26, +65,23,195,1,192,28,249,22,183,8,248,22,73,23,200,2,23,197,1,28,249, +22,181,8,248,22,72,23,200,2,23,196,1,251,22,148,9,2,18,6,26,26, 99,121,99,108,101,32,105,110,32,108,111,97,100,105,110,103,32,97,116,32,126, 101,58,32,126,101,23,200,1,249,22,2,22,73,248,22,86,249,22,71,23,206, 1,23,202,1,12,12,247,192,20,14,159,80,159,40,45,38,249,22,71,248,22, -182,14,247,22,150,12,23,197,1,20,14,159,80,159,40,40,38,250,80,159,43, -41,38,249,22,27,11,80,159,45,40,38,22,162,4,23,196,1,249,247,22,138, -5,23,198,1,248,22,59,248,22,174,13,23,198,1,87,94,28,28,248,22,170, -13,23,196,2,10,248,22,189,4,23,196,2,12,28,23,197,2,250,22,146,9, +186,14,247,22,154,12,23,197,1,20,14,159,80,159,40,40,38,250,80,159,43, +41,38,249,22,27,11,80,159,45,40,38,22,166,4,23,196,1,249,247,22,142, +5,23,198,1,248,22,59,248,22,178,13,23,198,1,87,94,28,28,248,22,174, +13,23,196,2,10,248,22,129,5,23,196,2,12,28,23,197,2,250,22,150,9, 11,6,15,15,98,97,100,32,109,111,100,117,108,101,32,112,97,116,104,23,200, -2,250,22,147,9,2,18,6,19,19,109,111,100,117,108,101,45,112,97,116,104, +2,250,22,151,9,2,18,6,19,19,109,111,100,117,108,101,45,112,97,116,104, 32,111,114,32,112,97,116,104,23,198,2,28,28,248,22,69,23,196,2,249,22, -177,8,248,22,72,23,198,2,2,4,11,248,22,182,4,248,22,96,196,28,28, -248,22,69,23,196,2,249,22,177,8,248,22,72,23,198,2,66,112,108,97,110, +181,8,248,22,72,23,198,2,2,4,11,248,22,186,4,248,22,96,196,28,28, +248,22,69,23,196,2,249,22,181,8,248,22,72,23,198,2,66,112,108,97,110, 101,116,11,87,94,28,207,12,20,14,159,80,159,37,52,38,80,158,37,50,90, -161,37,36,10,249,22,164,4,21,94,2,27,6,19,19,112,108,97,110,101,116, +161,37,36,10,249,22,168,4,21,94,2,27,6,19,19,112,108,97,110,101,116, 47,114,101,115,111,108,118,101,114,46,114,107,116,1,27,112,108,97,110,101,116, 45,109,111,100,117,108,101,45,110,97,109,101,45,114,101,115,111,108,118,101,114, 12,252,212,199,200,201,202,80,158,42,50,87,94,23,193,1,27,89,162,8,44, 37,46,79,115,104,111,119,45,99,111,108,108,101,99,116,105,111,110,45,101,114, -114,223,5,33,50,27,28,248,22,56,23,198,2,27,250,22,146,2,80,159,43, -44,38,249,22,71,23,203,2,247,22,148,14,11,28,23,193,2,192,87,94,23, +114,223,5,33,50,27,28,248,22,56,23,198,2,27,250,22,150,2,80,159,43, +44,38,249,22,71,23,203,2,247,22,152,14,11,28,23,193,2,192,87,94,23, 193,1,91,159,38,11,90,161,38,36,11,27,248,22,62,23,202,2,248,2,51, 248,2,53,23,195,1,27,251,80,159,47,54,38,2,18,23,202,1,28,248,22, 79,23,199,2,23,199,2,248,22,72,23,199,2,28,248,22,79,23,199,2,9, -248,22,73,23,199,2,249,22,188,13,23,195,1,28,248,22,79,23,197,1,87, -94,23,197,1,6,8,8,109,97,105,110,46,114,107,116,249,22,130,7,23,199, -1,6,4,4,46,114,107,116,28,248,22,171,6,23,198,2,87,94,23,194,1, -27,27,28,23,200,2,28,249,22,177,8,23,202,2,80,158,43,47,80,158,41, -48,27,248,22,183,4,23,202,2,28,248,22,170,13,23,194,2,91,159,39,11, -90,161,39,36,11,248,22,191,13,23,197,1,87,95,83,160,38,11,80,158,45, +248,22,73,23,199,2,249,22,128,14,23,195,1,28,248,22,79,23,197,1,87, +94,23,197,1,6,8,8,109,97,105,110,46,114,107,116,249,22,134,7,23,199, +1,6,4,4,46,114,107,116,28,248,22,175,6,23,198,2,87,94,23,194,1, +27,27,28,23,200,2,28,249,22,181,8,23,202,2,80,158,43,47,80,158,41, +48,27,248,22,187,4,23,202,2,28,248,22,174,13,23,194,2,91,159,39,11, +90,161,39,36,11,248,22,131,14,23,197,1,87,95,83,160,38,11,80,158,45, 47,23,204,2,83,160,38,11,80,158,45,48,192,192,11,11,28,23,193,2,192, -87,94,23,193,1,27,247,22,139,5,28,23,193,2,192,87,94,23,193,1,247, -22,147,14,27,250,22,146,2,80,159,44,44,38,249,22,71,23,204,2,23,199, +87,94,23,193,1,27,247,22,143,5,28,23,193,2,192,87,94,23,193,1,247, +22,151,14,27,250,22,150,2,80,159,44,44,38,249,22,71,23,204,2,23,199, 2,11,28,23,193,2,192,87,94,23,193,1,91,159,38,11,90,161,38,36,11, -248,2,55,248,2,57,23,203,2,250,22,1,22,188,13,23,199,1,249,22,85, +248,2,55,248,2,57,23,203,2,250,22,1,22,128,14,23,199,1,249,22,85, 249,22,2,32,0,89,162,8,44,37,44,9,222,33,59,23,200,1,248,22,81, -27,248,22,174,6,23,202,2,28,249,22,176,3,194,39,28,249,22,177,6,2, -28,249,22,129,7,204,249,22,164,3,198,39,249,22,130,7,250,22,129,7,205, -36,249,22,164,3,199,39,2,29,200,200,28,248,22,170,13,23,198,2,87,94, -23,194,1,28,248,22,129,14,23,198,2,91,159,39,11,90,161,39,36,11,248, -22,191,13,23,201,2,87,95,23,195,1,23,193,1,28,249,22,157,14,2,60, -248,22,175,13,23,197,1,249,80,159,44,53,38,23,202,2,2,30,23,200,2, +27,248,22,178,6,23,202,2,28,249,22,180,3,194,39,28,249,22,181,6,2, +28,249,22,133,7,204,249,22,168,3,198,39,249,22,134,7,250,22,133,7,205, +36,249,22,168,3,199,39,2,29,200,200,28,248,22,174,13,23,198,2,87,94, +23,194,1,28,248,22,133,14,23,198,2,91,159,39,11,90,161,39,36,11,248, +22,131,14,23,201,2,87,95,23,195,1,23,193,1,28,249,22,161,14,2,60, +248,22,179,13,23,197,1,249,80,159,44,53,38,23,202,2,2,30,23,200,2, 248,22,81,6,26,26,32,40,97,32,112,97,116,104,32,109,117,115,116,32,98, -101,32,97,98,115,111,108,117,116,101,41,28,249,22,177,8,248,22,72,23,200, -2,2,27,27,250,22,146,2,80,159,43,44,38,249,22,71,23,203,2,247,22, -148,14,11,28,23,193,2,192,87,94,23,193,1,91,159,39,11,90,161,38,36, +101,32,97,98,115,111,108,117,116,101,41,28,249,22,181,8,248,22,72,23,200, +2,2,27,27,250,22,150,2,80,159,43,44,38,249,22,71,23,203,2,247,22, +152,14,11,28,23,193,2,192,87,94,23,193,1,91,159,39,11,90,161,38,36, 11,27,248,22,96,23,203,2,248,2,61,248,2,63,23,195,1,90,161,37,38, -11,28,248,22,79,248,22,98,23,203,2,28,248,22,79,23,194,2,249,22,161, +11,28,248,22,79,248,22,98,23,203,2,28,248,22,79,23,194,2,249,22,165, 14,0,8,35,114,120,34,91,46,93,34,23,196,2,11,10,27,27,28,23,197, 2,249,22,85,28,248,22,79,248,22,98,23,207,2,21,93,6,5,5,109,122, 108,105,98,249,22,1,22,85,249,22,2,32,0,89,162,8,44,37,44,9,222, 33,67,248,22,98,23,210,2,23,197,2,28,248,22,79,23,196,2,248,22,81, 23,197,2,23,195,2,251,80,159,49,54,38,2,18,23,204,1,248,22,72,23, -198,2,248,22,73,23,198,1,249,22,188,13,23,195,1,28,23,198,1,87,94, -23,196,1,27,248,22,174,6,23,199,2,28,249,22,176,3,194,39,28,249,22, -177,6,2,28,249,22,129,7,201,249,22,164,3,198,39,249,22,130,7,250,22, -129,7,202,36,249,22,164,3,199,39,2,29,197,197,28,248,22,79,23,197,1, -87,94,23,197,1,6,8,8,109,97,105,110,46,114,107,116,28,249,22,161,14, -0,8,35,114,120,34,91,46,93,34,23,199,2,27,248,22,174,6,23,199,2, -28,249,22,176,3,194,39,28,249,22,177,6,2,28,249,22,129,7,201,249,22, -164,3,198,39,249,22,130,7,250,22,129,7,202,36,249,22,164,3,199,39,2, -29,197,197,249,22,130,7,23,199,1,6,4,4,46,114,107,116,28,249,22,177, -8,248,22,72,23,200,2,64,102,105,108,101,27,249,22,131,14,248,22,135,14, -248,22,96,23,202,2,27,28,23,202,2,28,249,22,177,8,23,204,2,80,158, -45,47,80,158,43,48,27,248,22,183,4,23,204,2,28,248,22,170,13,23,194, -2,91,159,39,11,90,161,39,36,11,248,22,191,13,23,197,1,87,95,83,160, +198,2,248,22,73,23,198,1,249,22,128,14,23,195,1,28,23,198,1,87,94, +23,196,1,27,248,22,178,6,23,199,2,28,249,22,180,3,194,39,28,249,22, +181,6,2,28,249,22,133,7,201,249,22,168,3,198,39,249,22,134,7,250,22, +133,7,202,36,249,22,168,3,199,39,2,29,197,197,28,248,22,79,23,197,1, +87,94,23,197,1,6,8,8,109,97,105,110,46,114,107,116,28,249,22,165,14, +0,8,35,114,120,34,91,46,93,34,23,199,2,27,248,22,178,6,23,199,2, +28,249,22,180,3,194,39,28,249,22,181,6,2,28,249,22,133,7,201,249,22, +168,3,198,39,249,22,134,7,250,22,133,7,202,36,249,22,168,3,199,39,2, +29,197,197,249,22,134,7,23,199,1,6,4,4,46,114,107,116,28,249,22,181, +8,248,22,72,23,200,2,64,102,105,108,101,27,249,22,135,14,248,22,139,14, +248,22,96,23,202,2,27,28,23,202,2,28,249,22,181,8,23,204,2,80,158, +45,47,80,158,43,48,27,248,22,187,4,23,204,2,28,248,22,174,13,23,194, +2,91,159,39,11,90,161,39,36,11,248,22,131,14,23,197,1,87,95,83,160, 38,11,80,158,47,47,23,206,2,83,160,38,11,80,158,47,48,192,192,11,11, -28,23,193,2,192,87,94,23,193,1,27,247,22,139,5,28,23,193,2,192,87, -94,23,193,1,247,22,147,14,91,159,39,11,90,161,39,36,11,248,22,191,13, -23,197,2,87,95,23,195,1,23,193,1,28,249,22,157,14,2,60,248,22,175, +28,23,193,2,192,87,94,23,193,1,27,247,22,143,5,28,23,193,2,192,87, +94,23,193,1,247,22,151,14,91,159,39,11,90,161,39,36,11,248,22,131,14, +23,197,2,87,95,23,195,1,23,193,1,28,249,22,161,14,2,60,248,22,179, 13,23,197,1,249,80,159,45,53,38,23,198,1,2,30,195,12,87,94,28,28, -248,22,170,13,23,194,2,10,248,22,129,8,23,194,2,87,94,23,199,1,12, -28,23,199,2,250,22,146,9,67,114,101,113,117,105,114,101,249,22,155,7,6, +248,22,174,13,23,194,2,10,248,22,133,8,23,194,2,87,94,23,199,1,12, +28,23,199,2,250,22,150,9,67,114,101,113,117,105,114,101,249,22,159,7,6, 17,17,98,97,100,32,109,111,100,117,108,101,32,112,97,116,104,126,97,28,23, 198,2,248,22,72,23,199,2,6,0,0,23,202,1,87,94,23,199,1,250,22, -147,9,2,18,249,22,155,7,6,13,13,109,111,100,117,108,101,32,112,97,116, +151,9,2,18,249,22,159,7,6,13,13,109,111,100,117,108,101,32,112,97,116, 104,126,97,28,23,198,2,248,22,72,23,199,2,6,0,0,23,200,2,27,28, -248,22,129,8,23,195,2,249,22,134,8,23,196,2,36,249,22,133,14,248,22, -134,14,23,197,2,11,27,28,248,22,129,8,23,196,2,249,22,134,8,23,197, +248,22,133,8,23,195,2,249,22,138,8,23,196,2,36,249,22,137,14,248,22, +138,14,23,197,2,11,27,28,248,22,133,8,23,196,2,249,22,138,8,23,197, 2,37,248,80,159,42,55,38,23,195,2,91,159,39,11,90,161,39,36,11,28, -248,22,129,8,23,199,2,250,22,7,2,31,249,22,134,8,23,203,2,38,2, -31,248,22,191,13,23,198,2,87,95,23,195,1,23,193,1,27,28,248,22,129, -8,23,200,2,249,22,134,8,23,201,2,39,249,80,159,47,53,38,23,197,2, -5,0,27,28,248,22,129,8,23,201,2,249,22,134,8,23,202,2,40,248,22, -182,4,23,200,2,27,27,250,22,146,2,80,159,51,43,38,248,22,182,14,247, -22,150,12,11,28,23,193,2,192,87,94,23,193,1,27,247,22,130,2,87,94, -250,22,144,2,80,159,52,43,38,248,22,182,14,247,22,150,12,195,192,87,95, -28,23,208,1,27,250,22,146,2,23,197,2,197,11,28,23,193,1,12,87,95, +248,22,133,8,23,199,2,250,22,7,2,31,249,22,138,8,23,203,2,38,2, +31,248,22,131,14,23,198,2,87,95,23,195,1,23,193,1,27,28,248,22,133, +8,23,200,2,249,22,138,8,23,201,2,39,249,80,159,47,53,38,23,197,2, +5,0,27,28,248,22,133,8,23,201,2,249,22,138,8,23,202,2,40,248,22, +186,4,23,200,2,27,27,250,22,150,2,80,159,51,43,38,248,22,186,14,247, +22,154,12,11,28,23,193,2,192,87,94,23,193,1,27,247,22,130,2,87,94, +250,22,148,2,80,159,52,43,38,248,22,186,14,247,22,154,12,195,192,87,95, +28,23,208,1,27,250,22,150,2,23,197,2,197,11,28,23,193,1,12,87,95, 27,27,28,248,22,17,80,159,51,46,38,80,159,50,46,38,247,22,19,250,22, -25,248,22,23,23,197,2,80,159,53,45,38,23,196,1,27,248,22,182,14,247, -22,150,12,249,22,3,83,158,40,20,100,94,89,162,8,44,37,55,9,226,12, +25,248,22,23,23,197,2,80,159,53,45,38,23,196,1,27,248,22,186,14,247, +22,154,12,249,22,3,83,158,40,20,100,94,89,162,8,44,37,55,9,226,12, 11,2,3,33,68,23,195,1,23,196,1,248,28,248,22,17,80,159,50,46,38, 32,0,89,162,44,37,42,9,222,33,69,80,159,49,59,37,89,162,44,36,51, -9,227,13,9,8,4,3,33,70,250,22,144,2,23,197,1,197,10,12,28,28, -248,22,129,8,23,202,1,11,28,248,22,171,6,23,206,2,10,28,248,22,56, -23,206,2,10,28,248,22,69,23,206,2,249,22,177,8,248,22,72,23,208,2, -2,27,11,250,22,144,2,80,159,50,44,38,28,248,22,171,6,23,209,2,249, -22,71,23,210,1,27,28,23,212,2,28,249,22,177,8,23,214,2,80,158,55, -47,87,94,23,212,1,80,158,53,48,27,248,22,183,4,23,214,2,28,248,22, -170,13,23,194,2,91,159,39,11,90,161,39,36,11,248,22,191,13,23,197,1, +9,227,13,9,8,4,3,33,70,250,22,148,2,23,197,1,197,10,12,28,28, +248,22,133,8,23,202,1,11,28,248,22,175,6,23,206,2,10,28,248,22,56, +23,206,2,10,28,248,22,69,23,206,2,249,22,181,8,248,22,72,23,208,2, +2,27,11,250,22,148,2,80,159,50,44,38,28,248,22,175,6,23,209,2,249, +22,71,23,210,1,27,28,23,212,2,28,249,22,181,8,23,214,2,80,158,55, +47,87,94,23,212,1,80,158,53,48,27,248,22,187,4,23,214,2,28,248,22, +174,13,23,194,2,91,159,39,11,90,161,39,36,11,248,22,131,14,23,197,1, 87,95,83,160,38,11,80,158,57,47,23,23,83,160,38,11,80,158,57,48,192, -192,11,11,28,23,193,2,192,87,94,23,193,1,27,247,22,139,5,28,23,193, -2,192,87,94,23,193,1,247,22,147,14,249,22,71,23,210,1,247,22,148,14, -252,22,131,8,23,208,1,23,207,1,23,205,1,23,203,1,201,12,193,87,96, +192,11,11,28,23,193,2,192,87,94,23,193,1,27,247,22,143,5,28,23,193, +2,192,87,94,23,193,1,247,22,151,14,249,22,71,23,210,1,247,22,152,14, +252,22,135,8,23,208,1,23,207,1,23,205,1,23,203,1,201,12,193,87,96, 83,160,38,11,80,158,36,50,248,80,159,37,58,38,249,22,27,11,80,159,39, -52,38,248,22,161,4,80,159,37,51,38,248,22,138,5,80,159,37,37,37,248, -22,141,13,80,159,37,42,37,83,160,38,11,80,158,36,50,248,80,159,37,58, +52,38,248,22,165,4,80,159,37,51,38,248,22,142,5,80,159,37,37,37,248, +22,145,13,80,159,37,42,37,83,160,38,11,80,158,36,50,248,80,159,37,58, 38,249,22,27,11,80,159,39,52,38,159,36,20,105,159,36,16,1,11,16,0, 83,158,42,20,103,145,2,1,2,1,29,11,11,11,11,11,10,38,80,158,36, 36,20,105,159,37,16,23,2,2,2,3,30,2,5,72,112,97,116,104,45,115, @@ -733,7 +733,7 @@ 11,11,16,2,2,20,2,21,16,2,11,11,16,2,2,20,2,21,38,38,37, 11,11,11,16,0,16,0,16,0,36,36,11,11,11,11,16,0,16,0,16,0, 36,36,16,0,16,15,83,158,36,16,2,89,162,44,37,45,9,223,0,33,32, -80,159,36,59,37,83,158,36,16,2,248,22,190,7,69,115,111,45,115,117,102, +80,159,36,59,37,83,158,36,16,2,248,22,130,8,69,115,111,45,115,117,102, 102,105,120,80,159,36,36,37,83,158,36,16,2,89,162,44,38,8,37,2,3, 223,0,33,41,80,159,36,37,37,83,158,36,16,2,32,0,89,162,8,44,37, 42,2,9,222,192,80,159,36,42,37,83,158,36,16,2,247,22,133,2,80,159, diff --git a/src/racket/src/list.c b/src/racket/src/list.c index 869b8b8e8b..cac3c2e694 100644 --- a/src/racket/src/list.c +++ b/src/racket/src/list.c @@ -100,11 +100,15 @@ static Scheme_Object *make_weak_hasheqv(int argc, Scheme_Object *argv[]); static Scheme_Object *make_immutable_hash(int argc, Scheme_Object *argv[]); static Scheme_Object *make_immutable_hasheq(int argc, Scheme_Object *argv[]); static Scheme_Object *make_immutable_hasheqv(int argc, Scheme_Object *argv[]); +static Scheme_Object *direct_hash(int argc, Scheme_Object *argv[]); +static Scheme_Object *direct_hasheq(int argc, Scheme_Object *argv[]); +static Scheme_Object *direct_hasheqv(int argc, Scheme_Object *argv[]); static Scheme_Object *hash_table_count(int argc, Scheme_Object *argv[]); static Scheme_Object *hash_table_copy(int argc, Scheme_Object *argv[]); static Scheme_Object *hash_p(int argc, Scheme_Object *argv[]); static Scheme_Object *hash_eq_p(int argc, Scheme_Object *argv[]); static Scheme_Object *hash_eqv_p(int argc, Scheme_Object *argv[]); +static Scheme_Object *hash_equal_p(int argc, Scheme_Object *argv[]); static Scheme_Object *hash_weak_p(int argc, Scheme_Object *argv[]); static Scheme_Object *hash_table_put_bang(int argc, Scheme_Object *argv[]); static Scheme_Object *hash_table_put(int argc, Scheme_Object *argv[]); @@ -511,6 +515,21 @@ scheme_init_list (Scheme_Env *env) "make-immutable-hasheqv", 1, 1), env); + scheme_add_global_constant("hash", + scheme_make_immed_prim(direct_hash, + "hash", + 0, -1), + env); + scheme_add_global_constant("hasheq", + scheme_make_immed_prim(direct_hasheq, + "hasheq", + 0, -1), + env); + scheme_add_global_constant("hasheqv", + scheme_make_immed_prim(direct_hasheqv, + "hasheqv", + 0, -1), + env); scheme_add_global_constant("hash?", scheme_make_folding_prim(hash_p, "hash?", @@ -526,6 +545,11 @@ scheme_init_list (Scheme_Env *env) "hash-eqv?", 1, 1, 1), env); + scheme_add_global_constant("hash-equal?", + scheme_make_folding_prim(hash_equal_p, + "hash-equal?", + 1, 1, 1), + env); scheme_add_global_constant("hash-weak?", scheme_make_folding_prim(hash_weak_p, "hash-weak?", @@ -1817,6 +1841,42 @@ static Scheme_Object *make_immutable_hasheqv(int argc, Scheme_Object *argv[]) return make_immutable_table("make-immutable-hasheqv", 2, argc, argv); } +static Scheme_Object *direct_table(const char *who, int kind, int argc, Scheme_Object *argv[]) +{ + int i; + Scheme_Hash_Tree *ht; + + if (argc & 0x1) { + scheme_arg_mismatch(who, + "key does not have a value (i.e., an odd number of arguments were provided): ", + argv[argc-1]); + return NULL; + } + + ht = scheme_make_hash_tree(kind); + + for (i = 0; i < argc; i += 2) { + ht = scheme_hash_tree_set(ht, argv[i], argv[i+1]); + } + + return (Scheme_Object *)ht; +} + +static Scheme_Object *direct_hash(int argc, Scheme_Object *argv[]) +{ + return direct_table("hash", 1, argc, argv); +} + +static Scheme_Object *direct_hasheq(int argc, Scheme_Object *argv[]) +{ + return direct_table("hasheq", 0, argc, argv); +} + +static Scheme_Object *direct_hasheqv(int argc, Scheme_Object *argv[]) +{ + return direct_table("hasheqv", 2, argc, argv); +} + Scheme_Hash_Table *scheme_make_hash_table_equal() { Scheme_Hash_Table *t; @@ -2005,6 +2065,29 @@ static Scheme_Object *hash_eqv_p(int argc, Scheme_Object *argv[]) return scheme_false; } +static Scheme_Object *hash_equal_p(int argc, Scheme_Object *argv[]) +{ + Scheme_Object *o = argv[0]; + + if (SCHEME_CHAPERONEP(o)) + o = SCHEME_CHAPERONE_VAL(o); + + if (SCHEME_HASHTP(o)) { + if (((Scheme_Hash_Table *)o)->compare == compare_equal) + return scheme_true; + } else if (SCHEME_HASHTRP(o)) { + if (SCHEME_HASHTR_FLAGS((Scheme_Hash_Tree *)o) & 0x1) + return scheme_true; + } else if (SCHEME_BUCKTP(o)) { + if (((Scheme_Bucket_Table *)o)->compare == compare_equal) + return scheme_true; + } else { + scheme_wrong_type("hash-equal?", "hash", 0, argc, argv); + } + + return scheme_false; +} + static Scheme_Object *hash_weak_p(int argc, Scheme_Object *argv[]) { Scheme_Object *o = argv[0]; diff --git a/src/racket/src/schminc.h b/src/racket/src/schminc.h index 32f1adcd73..9da6e8a4e5 100644 --- a/src/racket/src/schminc.h +++ b/src/racket/src/schminc.h @@ -13,7 +13,7 @@ #define USE_COMPILED_STARTUP 1 -#define EXPECTED_PRIM_COUNT 988 +#define EXPECTED_PRIM_COUNT 992 #define EXPECTED_UNSAFE_COUNT 65 #define EXPECTED_FLFXNUM_COUNT 53 diff --git a/src/racket/src/schvers.h b/src/racket/src/schvers.h index ce19dbda3f..5362b8bb67 100644 --- a/src/racket/src/schvers.h +++ b/src/racket/src/schvers.h @@ -13,12 +13,12 @@ consistently.) */ -#define MZSCHEME_VERSION "4.2.5.10" +#define MZSCHEME_VERSION "4.2.5.11" #define MZSCHEME_VERSION_X 4 #define MZSCHEME_VERSION_Y 2 #define MZSCHEME_VERSION_Z 5 -#define MZSCHEME_VERSION_W 10 +#define MZSCHEME_VERSION_W 11 #define MZSCHEME_VERSION_MAJOR ((MZSCHEME_VERSION_X * 100) + MZSCHEME_VERSION_Y) #define MZSCHEME_VERSION_MINOR ((MZSCHEME_VERSION_Z * 1000) + MZSCHEME_VERSION_W) From 2ded5ce2ceefdbb2cde88aa470b7237b09cfc4ab Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Fri, 23 Apr 2010 15:15:41 -0400 Subject: [PATCH 13/43] more global patterns to avoid --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6f43a4e0ae..ce6902a12e 100644 --- a/.gitignore +++ b/.gitignore @@ -10,5 +10,7 @@ # a common convenient place to set the PLTADDON directory to /add-on/ -# common backup file suffixes +# common backups, autosaves, and lock files *~ +\#* +.#* From 8dc93d9877709b3d0ff5852c1ef139c3e62c3e19 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Fri, 23 Apr 2010 14:55:13 -0500 Subject: [PATCH 14/43] Fixed check syntax so it deals with the .rkt and .ss conflation properly --- collects/drscheme/syncheck.ss | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/collects/drscheme/syncheck.ss b/collects/drscheme/syncheck.ss index 2841cc8c6e..09c7ad29db 100644 --- a/collects/drscheme/syncheck.ss +++ b/collects/drscheme/syncheck.ss @@ -2276,16 +2276,28 @@ If the namespace does not, they are colored the unbound color. (parameterize ([current-namespace user-namespace] [current-directory user-directory] [current-load-relative-directory user-directory]) - (let ([ans (with-handlers ([exn:fail? (λ (x) #f)]) - (cond - [(module-path-index? datum) - (resolved-module-path-name - (module-path-index-resolve datum))] - [else - (resolved-module-path-name - ((current-module-name-resolver) datum #f #f))]))]) - (and (path? ans) - ans)))) + (let* ([rkt-path/mod-path + (with-handlers ([exn:fail? (λ (x) #f)]) + (cond + [(module-path-index? datum) + (resolved-module-path-name + (module-path-index-resolve datum))] + [else + (resolved-module-path-name + ((current-module-name-resolver) datum #f #f))]))] + [rkt-path/f (and (path? rkt-path/mod-path) rkt-path/mod-path)]) + (let/ec k + (unless (path? rkt-path/f) (k rkt-path/f)) + (when (file-exists? rkt-path/f) (k rkt-path/f)) + (let* ([bts (path->bytes rkt-path/f)] + [len (bytes-length bts)]) + (unless (and (len . >= . 4) + (bytes=? #".rkt" (subbytes bts (- len 4)))) + (k rkt-path/f)) + (let ([ss-path (bytes->path (bytes-append (subbytes bts 0 (- len 4)) #".ss"))]) + (unless (file-exists? ss-path) + (k rkt-path/f)) + ss-path)))))) ;; make-require-open-menu : path -> menu -> void (define (make-require-open-menu file) From 6272d0511a2d9bd82671fbfbe7268d9730c30431 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Fri, 23 Apr 2010 15:43:57 -0500 Subject: [PATCH 15/43] dont bother running collects/help/help.ss --- collects/meta/props | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) mode change 100755 => 100644 collects/meta/props diff --git a/collects/meta/props b/collects/meta/props old mode 100755 new mode 100644 index 3a1d407212..db0efc4fa0 --- a/collects/meta/props +++ b/collects/meta/props @@ -812,6 +812,7 @@ path/s is either such a string or a list of them. "collects/handin-server/web-status-server.ss" drdr:command-line "mzc ~s" "collects/help" responsible (robby) "collects/help/bug-report.ss" drdr:command-line "mred-text -t ~s" +"collects/help/help.ss" drdr:command-line "mzc ~s" "collects/hierlist/hierlist.ss" drdr:command-line "mred-text -t ~s" "collects/honu" responsible (mflatt rafkind) "collects/htdp" responsible (matthias) @@ -897,8 +898,8 @@ path/s is either such a string or a list of them. "collects/make" responsible (mflatt) "collects/meta" responsible (eli) "collects/meta/check-dists.ss" drdr:command-line "" -"collects/meta/drdr" responsible (jay) drdr:command-line "" "collects/meta/contrib/completion/racket-completion.bash" responsible (samth sstrickl) drdr:command-line "" +"collects/meta/drdr" responsible (jay) drdr:command-line "" "collects/mred/edit-main.ss" drdr:command-line "mzc ~s" "collects/mred/edit.ss" drdr:command-line "mred-text -t ~s" "collects/mred/lang/main.ss" drdr:command-line "mred-text -t ~s" From 244f6e49083a75c77b48ec0d9ce6ffc621ef29af Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Fri, 23 Apr 2010 16:37:25 -0500 Subject: [PATCH 16/43] started requiring racket/ instead of scheme/ --- collects/drscheme/acks.ss | 2 +- collects/drscheme/arrow.ss | 2 +- collects/drscheme/default-code-style.ss | 4 ++-- collects/drscheme/drscheme.ss | 2 +- collects/drscheme/installer.ss | 4 ++-- collects/drscheme/main.ss | 4 ++-- collects/drscheme/private/app.ss | 6 ++---- collects/drscheme/private/bindings-browser.ss | 17 +++++++-------- collects/drscheme/private/bitmap-message.ss | 4 ++-- collects/drscheme/private/debug.ss | 14 ++++++------- collects/drscheme/private/drscheme-normal.ss | 10 ++++----- collects/drscheme/private/drsig.ss | 2 +- collects/drscheme/private/eb.ss | 6 +++--- .../drscheme/private/embedded-snip-utils.ss | 6 +++--- collects/drscheme/private/eval.ss | 12 +++++------ collects/drscheme/private/font.ss | 8 +++---- collects/drscheme/private/frame.ss | 9 ++++---- collects/drscheme/private/get-extend.ss | 2 +- collects/drscheme/private/help-desk.ss | 4 ++-- collects/drscheme/private/honu-logo.ss | 6 +++--- collects/drscheme/private/init.ss | 3 +-- .../drscheme/private/insert-large-letters.ss | 2 +- collects/drscheme/private/key.ss | 2 +- collects/drscheme/private/label-frame-mred.ss | 18 ++++++++-------- .../private/language-configuration.ss | 21 ++++++++++++------- .../private/language-object-contract.ss | 14 ++++++------- collects/drscheme/private/language.ss | 10 ++++----- .../drscheme/private/launcher-bootstrap.ss | 4 ++-- .../private/launcher-mred-bootstrap.ss | 8 +++---- .../drscheme/private/launcher-mz-bootstrap.ss | 4 ++-- collects/drscheme/private/link.ss | 2 +- collects/drscheme/private/main.ss | 2 +- collects/drscheme/private/modes.ss | 6 +++--- collects/drscheme/private/module-browser.ss | 6 +++--- .../drscheme/private/module-language-tools.ss | 8 +++---- collects/drscheme/private/module-language.ss | 14 ++++++------- .../drscheme/private/multi-file-search.ss | 4 ++-- collects/drscheme/private/number-snip.ss | 4 ++-- collects/drscheme/private/palaka.ss | 4 ++-- collects/drscheme/private/prefs-contract.ss | 4 ++-- collects/drscheme/private/profile-drs.ss | 6 +++--- collects/drscheme/private/recon.ss | 4 ++-- collects/drscheme/private/rep.ss | 12 +++++------ collects/drscheme/private/stick-figures.ss | 8 +++---- collects/drscheme/private/tools.ss | 10 ++++----- collects/drscheme/private/tracing.ss | 14 ++++++------- collects/drscheme/private/ts.ss | 3 +-- collects/drscheme/private/unit.ss | 12 +++++------ collects/drscheme/sprof.ss | 2 +- collects/drscheme/syncheck-drscheme-button.ss | 2 +- collects/drscheme/syncheck.ss | 2 +- collects/drscheme/tool-lib.ss | 2 +- collects/drscheme/tool.ss | 9 ++++---- 53 files changed, 174 insertions(+), 176 deletions(-) diff --git a/collects/drscheme/acks.ss b/collects/drscheme/acks.ss index 20fdc9e163..601afb6739 100644 --- a/collects/drscheme/acks.ss +++ b/collects/drscheme/acks.ss @@ -1,4 +1,4 @@ -#lang scheme/base +#lang racket/base (provide get-general-acks get-translating-acks diff --git a/collects/drscheme/arrow.ss b/collects/drscheme/arrow.ss index 3c27480bce..6cc8852bc0 100644 --- a/collects/drscheme/arrow.ss +++ b/collects/drscheme/arrow.ss @@ -1,4 +1,4 @@ -#lang scheme/base +#lang racket/base (require scheme/class scheme/math diff --git a/collects/drscheme/default-code-style.ss b/collects/drscheme/default-code-style.ss index b4ea007e2d..971c64d4bc 100644 --- a/collects/drscheme/default-code-style.ss +++ b/collects/drscheme/default-code-style.ss @@ -1,4 +1,4 @@ -(module default-code-style mzscheme +#lang racket/base (provide color-default-code-styles bw-default-code-styles code-style-color @@ -24,4 +24,4 @@ (list 'unbound-variable (make-code-style "red" #f #f #f)) (list 'bound-variable (make-code-style "navy" #f #f #f)) (list 'primitive (make-code-style "navy" #f #f #f)) - (list 'constant (make-code-style '(51 135 39) #f #f #f))))) + (list 'constant (make-code-style '(51 135 39) #f #f #f)))) diff --git a/collects/drscheme/drscheme.ss b/collects/drscheme/drscheme.ss index e5c5207b8f..fab93a1b2e 100644 --- a/collects/drscheme/drscheme.ss +++ b/collects/drscheme/drscheme.ss @@ -1,4 +1,4 @@ -#lang scheme/base +#lang racket/base (require scheme/gui/base "private/key.ss") (define debugging? (getenv "PLTDRDEBUG")) diff --git a/collects/drscheme/installer.ss b/collects/drscheme/installer.ss index 79c6c2883f..c6259165ac 100644 --- a/collects/drscheme/installer.ss +++ b/collects/drscheme/installer.ss @@ -1,4 +1,4 @@ -(module installer mzscheme +#lang racket/base (require mzlib/file mzlib/etc launcher) @@ -18,4 +18,4 @@ (mred-program-launcher-path "DrScheme") (cons `(exe-name . "DrScheme") - (build-aux-from-path (build-path (collection-path "drscheme") "drscheme"))))))) + (build-aux-from-path (build-path (collection-path "drscheme") "drscheme")))))) diff --git a/collects/drscheme/main.ss b/collects/drscheme/main.ss index f5202c93ea..1c1d394370 100644 --- a/collects/drscheme/main.ss +++ b/collects/drscheme/main.ss @@ -1,2 +1,2 @@ -(module main scheme/base - (require "drscheme.ss")) +#lang racket/base +(require "drscheme.ss") diff --git a/collects/drscheme/private/app.ss b/collects/drscheme/private/app.ss index 71c67d4822..47dff1bcbc 100644 --- a/collects/drscheme/private/app.ss +++ b/collects/drscheme/private/app.ss @@ -1,10 +1,8 @@ #lang scheme/unit -(require mzlib/class - mzlib/list - scheme/file +(require racket/class string-constants - mred + racket/gui/base framework browser/external setup/getinfo diff --git a/collects/drscheme/private/bindings-browser.ss b/collects/drscheme/private/bindings-browser.ss index 9a2b5181ef..74bae33bd5 100644 --- a/collects/drscheme/private/bindings-browser.ss +++ b/collects/drscheme/private/bindings-browser.ss @@ -1,4 +1,4 @@ -#lang mzscheme +#lang racket/base #| CODE COPIED (with permission ...) from syntax-browser.ss @@ -9,13 +9,10 @@ Marshalling (and hence the 'read' method of the snipclass omitted for fast proto |# - (require mzlib/pretty - mzlib/list - mzlib/class - mred - mzlib/match - mzlib/string - mzlib/contract) + (require racket/pretty + racket/class + racket/gui/base + racket/contract) (provide render-bindings/snip) @@ -64,7 +61,7 @@ Marshalling (and hence the 'read' method of the snipclass omitted for fast proto ; how to enrich the notion of an output-port to get 'bold'ing to ; work otherwise... (let* ([before (send output-text last-position)]) - (pretty-print (syntax-object->datum stx)) + (pretty-print (syntax->datum stx)) (let* ([post-newline (send output-text last-position)]) (send output-text delete post-newline) ; delete the trailing \n. yuck! (send output-text insert " ") @@ -164,7 +161,7 @@ Marshalling (and hence the 'read' method of the snipclass omitted for fast proto (define black-style-delta (make-object style-delta% 'change-normal-color)) (define green-style-delta (make-object style-delta%)) - (send green-style-delta set-delta-foreground "forest green") + (void (send green-style-delta set-delta-foreground "forest green")) (define turn-snip% (class snip% diff --git a/collects/drscheme/private/bitmap-message.ss b/collects/drscheme/private/bitmap-message.ss index 80c440b0f7..afa90a2c9a 100644 --- a/collects/drscheme/private/bitmap-message.ss +++ b/collects/drscheme/private/bitmap-message.ss @@ -1,6 +1,6 @@ -#lang scheme +#lang racket/base -(require mred/mred) +(require racket/gui/base racket/class) (provide bitmap-message%) (define bitmap-message% diff --git a/collects/drscheme/private/debug.ss b/collects/drscheme/private/debug.ss index a60d0c792b..10214d7789 100644 --- a/collects/drscheme/private/debug.ss +++ b/collects/drscheme/private/debug.ss @@ -1,4 +1,4 @@ -#lang scheme/base +#lang racket/base #| @@ -10,11 +10,11 @@ profile todo: (require errortrace/errortrace-key scheme/unit - scheme/contract + racket/contract errortrace/stacktrace - scheme/class - scheme/path - scheme/gui/base + racket/class + racket/path + racket/gui/base string-constants framework framework/private/bday @@ -23,9 +23,9 @@ profile todo: "bindings-browser.ss" net/sendurl net/url - scheme/match + racket/match mrlib/include-bitmap - (for-syntax scheme/base)) + (for-syntax racket/base)) (define orig (current-output-port)) diff --git a/collects/drscheme/private/drscheme-normal.ss b/collects/drscheme/private/drscheme-normal.ss index 428f013005..1450eeae21 100644 --- a/collects/drscheme/private/drscheme-normal.ss +++ b/collects/drscheme/private/drscheme-normal.ss @@ -1,12 +1,12 @@ -#lang scheme/base +#lang racket/base (require mred - scheme/class - scheme/cmdline - scheme/list + racket/class + racket/cmdline + racket/list framework/private/bday framework/splash - scheme/file + racket/file "eb.ss") (define files-to-open (command-line #:args filenames filenames)) diff --git a/collects/drscheme/private/drsig.ss b/collects/drscheme/private/drsig.ss index 414fe8d8bc..a41a6860b6 100644 --- a/collects/drscheme/private/drsig.ss +++ b/collects/drscheme/private/drsig.ss @@ -1,4 +1,4 @@ -#lang scheme/base +#lang racket/base (require scheme/unit) (provide drscheme:eval^ diff --git a/collects/drscheme/private/eb.ss b/collects/drscheme/private/eb.ss index 6b74f5561f..09e3c99a93 100644 --- a/collects/drscheme/private/eb.ss +++ b/collects/drscheme/private/eb.ss @@ -1,7 +1,7 @@ -#lang scheme/base -(require scheme/class +#lang racket/base +(require racket/class framework/splash - scheme/gui/base) + racket/gui/base) (provide install-eb) (define (install-eb) diff --git a/collects/drscheme/private/embedded-snip-utils.ss b/collects/drscheme/private/embedded-snip-utils.ss index 9e96e233be..3c3dcf55a5 100644 --- a/collects/drscheme/private/embedded-snip-utils.ss +++ b/collects/drscheme/private/embedded-snip-utils.ss @@ -1,6 +1,6 @@ -#lang scheme/base -(require scheme/class - scheme/gui/base) +#lang racket/base +(require racket/class + racket/gui/base) (provide get-enclosing-editor-frame) diff --git a/collects/drscheme/private/eval.ss b/collects/drscheme/private/eval.ss index 8c55abdbb3..4cc00542d0 100644 --- a/collects/drscheme/private/eval.ss +++ b/collects/drscheme/private/eval.ss @@ -1,9 +1,9 @@ -#lang mzscheme +#lang racket/base (require mred - mzlib/unit - mzlib/port - mzlib/class + scheme/unit + racket/port + racket/class syntax/toplevel framework "drsig.ss") @@ -11,7 +11,7 @@ ;; to ensure this guy is loaded (and the snipclass installed) in the drscheme namespace & eventspace ;; these things are for effect only! (require mrlib/cache-image-snip - (prefix image-core: mrlib/image-core)) + (prefix-in image-core: mrlib/image-core)) (define op (current-output-port)) (define (oprintf . args) (apply fprintf op args)) @@ -173,7 +173,7 @@ (error-print-width 250) (current-ps-setup (make-object ps-setup%)) - (current-namespace (make-namespace 'empty)) + (current-namespace (make-empty-namespace)) (for-each (λ (x) (namespace-attach-module drscheme:init:system-namespace x)) to-be-copied-module-names)) diff --git a/collects/drscheme/private/font.ss b/collects/drscheme/private/font.ss index aa2dc23a8d..0428a5b698 100644 --- a/collects/drscheme/private/font.ss +++ b/collects/drscheme/private/font.ss @@ -1,8 +1,8 @@ -#lang mzscheme - (require mzlib/unit - mzlib/class +#lang racket/base + (require scheme/unit + racket/class + racket/gui/base "drsig.ss" - mred framework string-constants) diff --git a/collects/drscheme/private/frame.ss b/collects/drscheme/private/frame.ss index 30f5f6c471..c55512116f 100644 --- a/collects/drscheme/private/frame.ss +++ b/collects/drscheme/private/frame.ss @@ -1,9 +1,8 @@ #lang scheme/unit (require string-constants - mzlib/match - mzlib/class - mzlib/string - mzlib/list + racket/match + racket/class + racket/string "drsig.ss" mred framework @@ -11,7 +10,7 @@ net/head setup/plt-installer help/bug-report - scheme/file) + racket/file) (import [prefix drscheme:unit: drscheme:unit^] [prefix drscheme:app: drscheme:app^] diff --git a/collects/drscheme/private/get-extend.ss b/collects/drscheme/private/get-extend.ss index d0d492fac7..67e877d9f6 100644 --- a/collects/drscheme/private/get-extend.ss +++ b/collects/drscheme/private/get-extend.ss @@ -1,6 +1,6 @@ #lang scheme/unit -(require scheme/class +(require racket/class "drsig.ss") (import [prefix drscheme:unit: drscheme:unit^] diff --git a/collects/drscheme/private/help-desk.ss b/collects/drscheme/private/help-desk.ss index af8be7a308..cc1f6c5c1b 100644 --- a/collects/drscheme/private/help-desk.ss +++ b/collects/drscheme/private/help-desk.ss @@ -1,9 +1,9 @@ #lang scheme/unit -(require scheme/gui/base +(require racket/gui/base browser/external framework - scheme/class + racket/class net/url setup/dirs help/search diff --git a/collects/drscheme/private/honu-logo.ss b/collects/drscheme/private/honu-logo.ss index a60e3afa7c..6c36990c16 100644 --- a/collects/drscheme/private/honu-logo.ss +++ b/collects/drscheme/private/honu-logo.ss @@ -1,8 +1,8 @@ -#lang scheme/base +#lang racket/base (provide draw-honu) -(require scheme/class - scheme/gui/base +(require racket/class + racket/gui/base "palaka.ss") (define pi (atan 0 -1)) diff --git a/collects/drscheme/private/init.ss b/collects/drscheme/private/init.ss index 5c69bf7ca6..d3fc01bdc2 100644 --- a/collects/drscheme/private/init.ss +++ b/collects/drscheme/private/init.ss @@ -1,8 +1,7 @@ #lang scheme/unit (require string-constants "drsig.ss" - mzlib/list - mred) + racket/gui/base) (import) diff --git a/collects/drscheme/private/insert-large-letters.ss b/collects/drscheme/private/insert-large-letters.ss index 609d7ffa85..5184e03d5d 100644 --- a/collects/drscheme/private/insert-large-letters.ss +++ b/collects/drscheme/private/insert-large-letters.ss @@ -2,7 +2,7 @@ (require typed/mred/mred typed/framework/framework - scheme/class + racket/class string-constants/string-constant) diff --git a/collects/drscheme/private/key.ss b/collects/drscheme/private/key.ss index ccd52cc2d3..0df77cdffc 100644 --- a/collects/drscheme/private/key.ss +++ b/collects/drscheme/private/key.ss @@ -1,4 +1,4 @@ -#lang mzscheme +#lang racket/base (provide break-threads) (define super-cust (current-custodian)) (define first-child (make-custodian)) diff --git a/collects/drscheme/private/label-frame-mred.ss b/collects/drscheme/private/label-frame-mred.ss index 1ca3158cc0..842153fcb7 100644 --- a/collects/drscheme/private/label-frame-mred.ss +++ b/collects/drscheme/private/label-frame-mred.ss @@ -1,28 +1,28 @@ -#lang mzscheme - (require mred - mzlib/class) - (provide (all-from-except mred frame%) - (rename registering-frame% frame%) +#lang racket/base + (require racket/gui/base + racket/class) + (provide (except-out (all-from-out racket/gui/base) frame%) + (rename-out [registering-frame% frame%]) lookup-frame-name) (define (lookup-frame-name frame) (semaphore-wait label-sema) (begin0 - (hash-table-get label-ht frame (λ () #f)) + (hash-ref label-ht frame (λ () #f)) (semaphore-post label-sema))) (define label-sema (make-semaphore 1)) - (define label-ht (make-hash-table 'weak)) + (define label-ht (make-weak-hasheq)) (define registering-frame% (class frame% (define/override (set-label x) (semaphore-wait label-sema) - (hash-table-put! label-ht this x) + (hash-set! label-ht this x) (semaphore-post label-sema) (super set-label x)) (inherit get-label) (super-instantiate ()) (semaphore-wait label-sema) - (hash-table-put! label-ht this (get-label)) + (hash-set! label-ht this (get-label)) (semaphore-post label-sema))) diff --git a/collects/drscheme/private/language-configuration.ss b/collects/drscheme/private/language-configuration.ss index 1b9e223a7f..20efcb9c11 100644 --- a/collects/drscheme/private/language-configuration.ss +++ b/collects/drscheme/private/language-configuration.ss @@ -1,13 +1,13 @@ -#lang scheme/base +#lang racket/base (require scheme/unit mrlib/hierlist - scheme/class - scheme/contract - scheme/string - scheme/list + racket/class + racket/contract + racket/string + racket/list + racket/gui/base "drsig.ss" string-constants - mred framework setup/getinfo syntax/toplevel @@ -1252,7 +1252,12 @@ (message-box (string-constant drscheme) (format - "The drscheme-language-position, drscheme-language-modules, drscheme-language-numbers, and drscheme-language-readers specifications aren't correct. Expected (listof (cons string (listof string))), (listof (listof string)), (listof (listof number)), (listof string), (listof string), and (listof module-spec) respectively, where the lengths of the outer lists are the same. Got ~e, ~e, ~e, ~e, ~e, and ~e" + (string-append + "The drscheme-language-position, drscheme-language-modules, drscheme-language-numbers," + " and drscheme-language-readers specifications aren't correct. Expected" + " (listof (cons string (listof string))), (listof (listof string)), (listof (listof number)), (listof string)," + " (listof string), and (listof module-spec) respectively, where the lengths of the outer lists are the same." + " Got ~e, ~e, ~e, ~e, ~e, and ~e") lang-positions lang-modules numberss @@ -1431,7 +1436,7 @@ (let ([words #f]) (λ () (unless words - (set! words (text:get-completions/manuals '(scheme/base scheme/contract)))) + (set! words (text:get-completions/manuals '(racket/base racket/contract)))) words))) (define get-all-manual-keywords diff --git a/collects/drscheme/private/language-object-contract.ss b/collects/drscheme/private/language-object-contract.ss index dbb6eba60c..a9836f12d4 100644 --- a/collects/drscheme/private/language-object-contract.ss +++ b/collects/drscheme/private/language-object-contract.ss @@ -1,14 +1,14 @@ #reader scribble/reader -#lang scheme/base -(require (for-syntax scheme/base) +#lang racket/base +(require (for-syntax racket/base) scribble/srcdoc - scheme/class - scheme/gui/base - scheme/contract + racket/class + racket/gui/base + racket/contract "recon.ss") -(require/doc scheme/base scribble/manual) +(require/doc racket/base scribble/manual) -(require (for-meta 2 scheme/base)) +(require (for-meta 2 racket/base)) (provide language-object-abstraction) diff --git a/collects/drscheme/private/language.ss b/collects/drscheme/private/language.ss index 7387ce3377..d9f61db1c4 100644 --- a/collects/drscheme/private/language.ss +++ b/collects/drscheme/private/language.ss @@ -9,17 +9,17 @@ ;; NOTE: this module instantiates stacktrace itself, so we have ;; to be careful to not mix that instantiation with the one - ;; drscheme/private/debug.ss does. errortrace-lib's is for the + ;; drracket/private/debug.ss does. errortrace-lib's is for the ;; compilation handling, DrScheme's is for profiling and test coverage ;; (which do not do compilation) (prefix-in el: errortrace/errortrace-lib) mzlib/pconvert - scheme/pretty + racket/pretty mzlib/struct - scheme/class - scheme/file - scheme/list + racket/class + racket/file + racket/list compiler/embed launcher mred diff --git a/collects/drscheme/private/launcher-bootstrap.ss b/collects/drscheme/private/launcher-bootstrap.ss index 13e63f0313..36074c81e3 100644 --- a/collects/drscheme/private/launcher-bootstrap.ss +++ b/collects/drscheme/private/launcher-bootstrap.ss @@ -1,8 +1,8 @@ -#lang scheme/base +#lang racket/base (provide startup) -(require scheme/file) +(require racket/file) (define (read-from-string s) (read (open-input-string s))) diff --git a/collects/drscheme/private/launcher-mred-bootstrap.ss b/collects/drscheme/private/launcher-mred-bootstrap.ss index 20820223ab..ac676bb763 100644 --- a/collects/drscheme/private/launcher-mred-bootstrap.ss +++ b/collects/drscheme/private/launcher-mred-bootstrap.ss @@ -1,9 +1,9 @@ -#lang scheme/base +#lang racket/base -(require scheme/gui/base "launcher-bootstrap.ss") +(require racket/gui/base "launcher-bootstrap.ss") (current-namespace (make-gui-empty-namespace)) -(namespace-require 'scheme/gui/base) -(namespace-require 'scheme/class) +(namespace-require 'racket/gui/base) +(namespace-require 'racket/class) (startup) diff --git a/collects/drscheme/private/launcher-mz-bootstrap.ss b/collects/drscheme/private/launcher-mz-bootstrap.ss index f591a62c7a..e2054aebca 100644 --- a/collects/drscheme/private/launcher-mz-bootstrap.ss +++ b/collects/drscheme/private/launcher-mz-bootstrap.ss @@ -1,8 +1,8 @@ -#lang scheme/base +#lang racket/base (require "launcher-bootstrap.ss") (current-namespace (make-base-empty-namespace)) -(namespace-require 'scheme/base) +(namespace-require 'racket/base) (startup) diff --git a/collects/drscheme/private/link.ss b/collects/drscheme/private/link.ss index e2fabeceb9..e1ded533aa 100644 --- a/collects/drscheme/private/link.ss +++ b/collects/drscheme/private/link.ss @@ -1,4 +1,4 @@ -#lang scheme/base +#lang racket/base (require scheme/unit "modes.ss" "font.ss" diff --git a/collects/drscheme/private/main.ss b/collects/drscheme/private/main.ss index 998285168a..d54f1fd7dc 100644 --- a/collects/drscheme/private/main.ss +++ b/collects/drscheme/private/main.ss @@ -7,7 +7,7 @@ framework mzlib/class mzlib/list - scheme/path + racket/path browser/external setup/plt-installer) diff --git a/collects/drscheme/private/modes.ss b/collects/drscheme/private/modes.ss index 973d6275d2..f9a717578e 100644 --- a/collects/drscheme/private/modes.ss +++ b/collects/drscheme/private/modes.ss @@ -1,7 +1,7 @@ #lang scheme/unit (require string-constants - mzlib/class - mzlib/list + racket/class + racket/list framework "drsig.ss") @@ -23,7 +23,7 @@ (define (not-a-language-language? l) (and (not (null? l)) - (equal? (car (last-pair l)) + (equal? (last l) (string-constant no-language-chosen)))) (define (add-initial-modes) diff --git a/collects/drscheme/private/module-browser.ss b/collects/drscheme/private/module-browser.ss index d58fd4da64..281cfba0fc 100644 --- a/collects/drscheme/private/module-browser.ss +++ b/collects/drscheme/private/module-browser.ss @@ -1,7 +1,7 @@ -#lang scheme/base +#lang racket/base (require mred - scheme/class + racket/class syntax/moddep syntax/toplevel framework/framework @@ -9,7 +9,7 @@ mrlib/graph "drsig.ss" scheme/unit - scheme/async-channel + racket/async-channel setup/private/lib-roots) (define-struct req (filename key)) diff --git a/collects/drscheme/private/module-language-tools.ss b/collects/drscheme/private/module-language-tools.ss index 73bc52053d..deead1f19e 100644 --- a/collects/drscheme/private/module-language-tools.ss +++ b/collects/drscheme/private/module-language-tools.ss @@ -1,12 +1,12 @@ -#lang scheme/base +#lang racket/base (provide module-language-tools@) (require mrlib/switchable-button mrlib/bitmap-label - scheme/contract + racket/contract framework scheme/unit - scheme/class - scheme/gui/base + racket/class + racket/gui/base "drsig.ss") (define op (current-output-port)) diff --git a/collects/drscheme/private/module-language.ss b/collects/drscheme/private/module-language.ss index 7c09d02989..6ffa79b563 100644 --- a/collects/drscheme/private/module-language.ss +++ b/collects/drscheme/private/module-language.ss @@ -1,11 +1,11 @@ -#lang scheme/base +#lang racket/base (provide module-language@) (require scheme/unit - scheme/class - scheme/list - scheme/path - scheme/contract + racket/class + racket/list + racket/path + racket/contract mred compiler/embed compiler/cm @@ -382,7 +382,7 @@ #:literal-expression (begin (parameterize ([current-namespace (make-base-empty-namespace)]) - (namespace-require 'scheme/base) + (namespace-require 'racket/base) (compile `(namespace-require '',(string->symbol (path->string short-program-name)))))) #:cmdline '("-U" "--"))))) @@ -672,7 +672,7 @@ (raise-hopeless-syntax-error "bad syntax in name position of module" stx name)) (when filename (check-filename-matches filename name* stx)) - (let* (;; rewrite the module to use the scheme/base version of `module' + (let* (;; rewrite the module to use the racket/base version of `module' [mod (datum->syntax #'here 'module mod)] [expr (datum->syntax stx `(,mod ,name ,lang . ,body) stx stx)]) (values name lang expr))) diff --git a/collects/drscheme/private/multi-file-search.ss b/collects/drscheme/private/multi-file-search.ss index f185e45972..aa1647cd05 100644 --- a/collects/drscheme/private/multi-file-search.ss +++ b/collects/drscheme/private/multi-file-search.ss @@ -2,8 +2,8 @@ (require framework mzlib/class mred - scheme/file - scheme/path + racket/file + racket/path mzlib/thread mzlib/async-channel string-constants diff --git a/collects/drscheme/private/number-snip.ss b/collects/drscheme/private/number-snip.ss index 5426620d15..c224e5ab3a 100644 --- a/collects/drscheme/private/number-snip.ss +++ b/collects/drscheme/private/number-snip.ss @@ -1,6 +1,6 @@ -#lang mzscheme +#lang racket/base (require mred - mzlib/class + racket/class framework) (provide snip-class) diff --git a/collects/drscheme/private/palaka.ss b/collects/drscheme/private/palaka.ss index 70ba631293..f10c0e9f9f 100755 --- a/collects/drscheme/private/palaka.ss +++ b/collects/drscheme/private/palaka.ss @@ -1,5 +1,5 @@ -#lang scheme/base -(require scheme/class scheme/gui/base) +#lang racket/base +(require racket/class racket/gui/base) (provide draw-palaka palaka-pattern-size) (define scale 1) diff --git a/collects/drscheme/private/prefs-contract.ss b/collects/drscheme/private/prefs-contract.ss index dd62fb14d3..d850ca725e 100644 --- a/collects/drscheme/private/prefs-contract.ss +++ b/collects/drscheme/private/prefs-contract.ss @@ -1,6 +1,6 @@ -#lang scheme/base +#lang racket/base -(require (for-syntax scheme/base) +(require (for-syntax racket/base) framework/framework) (provide (rename-out [-preferences:get preferences:get]) diff --git a/collects/drscheme/private/profile-drs.ss b/collects/drscheme/private/profile-drs.ss index 78e0131d1f..819e83ae71 100644 --- a/collects/drscheme/private/profile-drs.ss +++ b/collects/drscheme/private/profile-drs.ss @@ -1,6 +1,6 @@ -#lang scheme/base -(require scheme/gui/base - scheme/class +#lang racket/base +(require racket/gui/base + racket/class profile/sampler profile/render-text profile/analyzer diff --git a/collects/drscheme/private/recon.ss b/collects/drscheme/private/recon.ss index 6c9a7f1822..3d7c37ce91 100644 --- a/collects/drscheme/private/recon.ss +++ b/collects/drscheme/private/recon.ss @@ -1,5 +1,5 @@ -#lang scheme/base -(require (for-syntax scheme/base)) +#lang racket/base +(require (for-syntax racket/base)) (provide reconstitute) (begin-for-syntax diff --git a/collects/drscheme/private/rep.ss b/collects/drscheme/private/rep.ss index 35aa44c1f5..7a8d95f40b 100644 --- a/collects/drscheme/private/rep.ss +++ b/collects/drscheme/private/rep.ss @@ -1,4 +1,4 @@ -#lang scheme/base +#lang racket/base #| @@ -20,15 +20,15 @@ TODO ;; user's io ports, to aid any debugging printouts. ;; (esp. useful when debugging the users's io) -(require scheme/class - scheme/path - scheme/pretty +(require racket/class + racket/path + racket/pretty scheme/unit - scheme/list + racket/list string-constants setup/xref - scheme/gui/base + racket/gui/base framework browser/external "drsig.ss" diff --git a/collects/drscheme/private/stick-figures.ss b/collects/drscheme/private/stick-figures.ss index 49a404ed67..dbe81bc423 100644 --- a/collects/drscheme/private/stick-figures.ss +++ b/collects/drscheme/private/stick-figures.ss @@ -1,7 +1,7 @@ -#lang mzscheme - (require mzlib/class - mzlib/pretty - mred) +#lang racket/base + (require racket/class + racket/pretty + racket/gui/base) (define head-size 40) (define small-bitmap-factor 1/2) diff --git a/collects/drscheme/private/tools.ss b/collects/drscheme/private/tools.ss index 5198030441..d66d10a192 100644 --- a/collects/drscheme/private/tools.ss +++ b/collects/drscheme/private/tools.ss @@ -1,9 +1,9 @@ #lang scheme/unit -(require scheme/class - scheme/list - scheme/runtime-path - scheme/contract +(require racket/class + racket/list + racket/runtime-path + racket/contract setup/getinfo mred framework @@ -13,7 +13,7 @@ mrlib/switchable-button string-constants) -(require (for-syntax scheme/base scheme/match)) +(require (for-syntax racket/base racket/match)) (import [prefix drscheme:frame: drscheme:frame^] [prefix drscheme:unit: drscheme:unit^] diff --git a/collects/drscheme/private/tracing.ss b/collects/drscheme/private/tracing.ss index 599b359d11..f30b0568cb 100644 --- a/collects/drscheme/private/tracing.ss +++ b/collects/drscheme/private/tracing.ss @@ -1,12 +1,12 @@ -#lang scheme/base +#lang racket/base -(require scheme/contract +(require racket/contract scheme/unit - scheme/class - scheme/path - scheme/port - scheme/list - scheme/gui/base + racket/class + racket/path + racket/port + racket/list + racket/gui/base string-constants framework (prefix-in tr: trace/stacktrace) diff --git a/collects/drscheme/private/ts.ss b/collects/drscheme/private/ts.ss index e1d6de5dc8..eb706554ef 100644 --- a/collects/drscheme/private/ts.ss +++ b/collects/drscheme/private/ts.ss @@ -1,5 +1,4 @@ -#reader scribble/reader -#lang scheme/base +#lang at-exp racket/base (require scribble/decode scribble/manual) diff --git a/collects/drscheme/private/unit.ss b/collects/drscheme/private/unit.ss index 67c1f52236..47b5df12c0 100644 --- a/collects/drscheme/private/unit.ss +++ b/collects/drscheme/private/unit.ss @@ -1,4 +1,4 @@ -#lang scheme/base +#lang racket/base #| closing: @@ -11,12 +11,12 @@ module browser threading seems wrong. |# - (require scheme/contract + (require racket/contract scheme/unit - scheme/class - scheme/path - scheme/port - scheme/list + racket/class + racket/path + racket/port + racket/list string-constants framework mrlib/name-message diff --git a/collects/drscheme/sprof.ss b/collects/drscheme/sprof.ss index 099dc03230..5f66b0c1ea 100644 --- a/collects/drscheme/sprof.ss +++ b/collects/drscheme/sprof.ss @@ -1,4 +1,4 @@ -#lang scheme/base +#lang racket/base (require scheme/gui/base framework scheme/class) diff --git a/collects/drscheme/syncheck-drscheme-button.ss b/collects/drscheme/syncheck-drscheme-button.ss index 25e5279643..a4d7f28d30 100644 --- a/collects/drscheme/syncheck-drscheme-button.ss +++ b/collects/drscheme/syncheck-drscheme-button.ss @@ -1,4 +1,4 @@ -#lang scheme/base +#lang racket/base (require scheme/class scheme/gui/base string-constants/string-constant) diff --git a/collects/drscheme/syncheck.ss b/collects/drscheme/syncheck.ss index 09c7ad29db..128cfa3496 100644 --- a/collects/drscheme/syncheck.ss +++ b/collects/drscheme/syncheck.ss @@ -1,4 +1,4 @@ -#lang scheme/base +#lang racket/base #| Check Syntax separates two classes of identifiers, diff --git a/collects/drscheme/tool-lib.ss b/collects/drscheme/tool-lib.ss index cbfa92f77b..440b8387fe 100644 --- a/collects/drscheme/tool-lib.ss +++ b/collects/drscheme/tool-lib.ss @@ -1,4 +1,4 @@ -#lang at-exp scheme/base +#lang at-exp racket/base #| diff --git a/collects/drscheme/tool.ss b/collects/drscheme/tool.ss index 7fd1b8188c..ff4a7fbf66 100644 --- a/collects/drscheme/tool.ss +++ b/collects/drscheme/tool.ss @@ -1,4 +1,5 @@ -(module tool mzscheme - (require "private/drsig.ss") - (provide drscheme:tool^ - drscheme:tool-exports^)) +#lang racket/base +(require "private/drsig.ss") +(provide drscheme:tool^ + drscheme:tool-exports^) + From 227aa7be73082eabaa8f6d3a5467d9c42c036809 Mon Sep 17 00:00:00 2001 From: Ryan Culpepper Date: Fri, 23 Apr 2010 16:49:40 -0600 Subject: [PATCH 17/43] syntax/parse: allow action patterns within list patterns --- collects/syntax/private/stxparse/rep.ss | 2 ++ 1 file changed, 2 insertions(+) diff --git a/collects/syntax/private/stxparse/rep.ss b/collects/syntax/private/stxparse/rep.ss index fcabc96e9e..cc1f1b96f1 100644 --- a/collects/syntax/private/stxparse/rep.ss +++ b/collects/syntax/private/stxparse/rep.ss @@ -774,6 +774,8 @@ #t] [(make pat:head _base _head tail) (check-list-pattern tail stx)] + [(make pat:ghost _base _ghost tail) + (check-list-pattern tail stx)] [(make pat:dots _base _head tail) (check-list-pattern tail stx)] [(make pat:compound _base '#:pair (list _head tail)) From d824fef4f76d1938b59345d69ca9ffbabce35f19 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 23 Apr 2010 17:00:51 -0600 Subject: [PATCH 18/43] add set-subset? --- collects/racket/set.rkt | 13 +++++++++++++ collects/scribblings/reference/sets.scrbl | 11 +++++++++++ 2 files changed, 24 insertions(+) diff --git a/collects/racket/set.rkt b/collects/racket/set.rkt index 2676037d7f..3dc363eb81 100644 --- a/collects/racket/set.rkt +++ b/collects/racket/set.rkt @@ -6,6 +6,7 @@ set-empty? set-count set-member? set-add set-remove set-union set-intersect set-subtract + set-subset? set-map set-for-each (rename-out [*in-set in-set]) for/set for/seteq for/seteqv @@ -163,6 +164,18 @@ (for/fold ([set set]) ([set2 (in-list sets)]) (set-subtract set set2))])) +(define (set-subset? set1 set2) + (unless (set? set1) (raise-type-error 'set-subset? "set" 0 set1 set2)) + (unless (set? set2) (raise-type-error 'set-subset? "set" 1 set1 set2)) + (let ([ht1 (set-ht set1)] + [ht2 (set-ht set2)]) + (unless (and (eq? (hash-eq? ht1) (hash-eq? ht2)) + (eq? (hash-eqv? ht1) (hash-eqv? ht2))) + (raise-mismatch-error 'set-subset? "second set's equivalence predicate is not the same as the first set: " + set2)) + (for/and ([v (in-hash-keys ht2)]) + (hash-ref ht1 v #f)))) + (define (set-map set proc) (unless (set? set) (raise-type-error 'set-map "set" 0 set proc)) (unless (and (procedure? proc) diff --git a/collects/scribblings/reference/sets.scrbl b/collects/scribblings/reference/sets.scrbl index 32bcf72223..a61ff00c9f 100644 --- a/collects/scribblings/reference/sets.scrbl +++ b/collects/scribblings/reference/sets.scrbl @@ -52,11 +52,13 @@ to a later element takes precedence over the later element.} Returns @scheme[#t] if @scheme[set] has no members, @scheme[#f] otherwise.} + @defproc[(set-member? [set set?] [v any/c]) boolean?]{ Returns @scheme[#t] if @scheme[v] is in @scheme[set], @scheme[#f] otherwise.} + @defproc[(set-add [set set?] [v any/c]) set?]{ @margin-note{Like operations on immutable hash tables, ``constant @@ -101,6 +103,15 @@ runs in time proportional to the total size of all given @scheme[set]s except the first one.} +@defproc[(set-subset? [set set?] [set2 set?]) boolean?]{ + +Returns @scheme[#t] if every member of @scheme[set2] is in +@scheme[set], @scheme[#f] otherwise. The @scheme[set] and +@scheme[set2] must use the same equivalence predicate +(@scheme[equal?], @scheme[eq?], or @scheme[eqv?]). This operation +runs in time proportional to the size of @scheme[set2].} + + @defproc[(set-map [set set?] [proc (any/c . -> . any/c)]) (listof any/c)]{ From 7cb13860ee6744179fc51a8edc6a7bbb07317d59 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 23 Apr 2010 17:00:53 -0600 Subject: [PATCH 19/43] reference racket conversions and scribble qq repairs --- collects/scribble/racket.ss | 9 +- collects/scribblings/reference/chars.scrbl | 4 +- collects/scribblings/reference/data.scrbl | 2 +- collects/scribblings/reference/mz.ss | 6 +- collects/scribblings/reference/numbers.scrbl | 6 +- collects/scribblings/reference/pairs.scrbl | 21 +- collects/scribblings/reference/regexps.scrbl | 368 +++++++++--------- .../scribblings/reference/sequences.scrbl | 5 +- collects/tests/mzscheme/set.ss | 5 + 9 files changed, 226 insertions(+), 200 deletions(-) diff --git a/collects/scribble/racket.ss b/collects/scribble/racket.ss index 57144a7a99..ab3a05ca64 100644 --- a/collects/scribble/racket.ss +++ b/collects/scribble/racket.ss @@ -519,7 +519,7 @@ (set! src-col (+ src-col (- (syntax-span c) 2))) (set! src-col (+ src-col (- (syntax-column (vector-ref vec 0)) (syntax-column c) - 1))))))) + 1)))))) (when (struct? (syntax-e c)) (out "#s" p-color) (set! src-col (+ src-col 2))) @@ -532,7 +532,7 @@ (hash-set! next-col-map src-col dest-col) (let lloop ([l (cond [(vector? (syntax-e c)) - (vector->short-list (syntax-e c) syntax-e)] + (vector->short-list (syntax-e c) syntax-e)] [(struct? (syntax-e c)) (let ([l (vector->list (struct->vector (syntax-e c)))]) ;; Need to build key datum, syntax-ize it internally, and @@ -599,7 +599,7 @@ p-color) (set! src-col (+ src-col 1)) #; - (hash-set! next-col-map src-col dest-col))] + (hash-set! next-col-map src-col dest-col)))] [(box? (syntax-e c)) (advance c init-line!) (let ([quote-depth (to-quoted "`" qq? quote-depth out color? inc-src-col)]) @@ -700,7 +700,8 @@ (hash? s) (graph-defn? s) (graph-reference? s) - (struct-proxy? s)) + (struct-proxy? s) + (and qq? (identifier? c))) (gen-typeset c multi-line? prefix1 prefix suffix color? qq?) (typeset-atom c (letrec ([mk diff --git a/collects/scribblings/reference/chars.scrbl b/collects/scribblings/reference/chars.scrbl index 0c163335dd..3a328a8b17 100644 --- a/collects/scribblings/reference/chars.scrbl +++ b/collects/scribblings/reference/chars.scrbl @@ -217,8 +217,8 @@ category, which is @indexed-scheme['lu], @indexed-scheme['ll], @indexed-scheme['cn].} @defproc[(make-known-char-range-list) - (listof (list/c nonnegative-integer? - nonnegative-integer? + (listof (list/c exact-nonnegative-integer? + exact-nonnegative-integer? boolean?))]{ Produces a list of three-element lists, where each three-element list diff --git a/collects/scribblings/reference/data.scrbl b/collects/scribblings/reference/data.scrbl index 25dd6272c2..188dd30191 100644 --- a/collects/scribblings/reference/data.scrbl +++ b/collects/scribblings/reference/data.scrbl @@ -108,7 +108,7 @@ used as an ephemeron key (see @secref["ephemerons"]). @scheme[(string->symbol str)], but the resulting symbol is a new @tech{unreadable symbol}. Calling @scheme[string->unreadable-symbol] twice with equivalent @scheme[str]s returns the same symbol, but - @scheme[read] never produces the symbol.} + @scheme[read] never produces the symbol. @examples[(string->unreadable-symbol "Apple") (eq? 'a (string->unreadable-symbol "a")) diff --git a/collects/scribblings/reference/mz.ss b/collects/scribblings/reference/mz.ss index f4055713fb..f3114f5d3c 100644 --- a/collects/scribblings/reference/mz.ss +++ b/collects/scribblings/reference/mz.ss @@ -90,7 +90,7 @@ (provide exnraise Exn) (provide margin-note/ref - refalso moreref Guide guideintro guidesecref + refalso moreref Guide guideintro guidealso guidesecref HonuManual) (define (margin-note/ref . s) @@ -117,6 +117,10 @@ (decode-content (append (list finger (guidesecref tag) " in " Guide " introduces ") s (list "."))))) + + (define (guidealso tag) + (apply margin-note + (decode-content (append (list finger "See also " (guidesecref tag) " in " Guide "."))))) (define Guide (other-manual '(lib "scribblings/guide/guide.scrbl"))) diff --git a/collects/scribblings/reference/numbers.scrbl b/collects/scribblings/reference/numbers.scrbl index 0498d27caa..438ad742cd 100644 --- a/collects/scribblings/reference/numbers.scrbl +++ b/collects/scribblings/reference/numbers.scrbl @@ -453,7 +453,7 @@ used. @defproc[(log [z number?]) number?]{ Returns the natural logarithm of @scheme[z]. The result is normally inexact, but it is @scheme[0] when @scheme[z] is an exact @scheme[1]. When @scheme[z] - is exact @scheme[0], @exnraise[exn:fail:contract:divide-by-zero].} + is exact @scheme[0], @exnraise[exn:fail:contract:divide-by-zero]. @mz-examples[(log (exp 1)) (log 2+3i) (log 1)]} @@ -883,7 +883,7 @@ numbers}, which are also known as @deftech{flonums}. Flonum-specific operations provide can better performance when used consistently, and they are as safe as generic operations like @scheme[+]. -@margin-note{See @guidesecref["fixnums+flonums"].} +@guidealso["fixnums+flonums"] @subsection{Flonum Arithmetic} @@ -1080,7 +1080,7 @@ Safe versions of @scheme[unsafe-fx=], @scheme[unsafe-fx<], @note-lib[racket/math] -@defthing[pi real]{ +@defthing[pi real?]{ An approximation to the ratio of a circle's circumference to its diameter: @number->string[pi].} diff --git a/collects/scribblings/reference/pairs.scrbl b/collects/scribblings/reference/pairs.scrbl index e89b37938d..b6234dd27f 100644 --- a/collects/scribblings/reference/pairs.scrbl +++ b/collects/scribblings/reference/pairs.scrbl @@ -26,7 +26,7 @@ @(define-syntax (defc_r stx) (syntax-case stx () - [(_ x ... example) + [(_ x ... example-arg) (let ([xs (map syntax-e (syntax->list #'(x ...)))]) (let ([name (string->symbol (string-append @@ -58,10 +58,25 @@ span))) (datum->syntax #'here c (list (syntax-source stx) 1 pos (add1 pos) 1))))] - [example (datum->syntax #'here (syntax->datum #'example))] + [example (let ([ex #'example-arg]) + (datum->syntax #f + (list + (datum->syntax #f + name + (vector (syntax-source ex) + (syntax-line ex) + (- (syntax-column ex) 2) + (- (syntax-position ex) 2) + 1)) + ex) + (vector (syntax-source ex) + (syntax-line ex) + (- (syntax-column ex) 3) + (- (syntax-position ex) 3) + (+ (syntax-span ex) 4))))] [equiv equiv]) #'(defproc (name [v contract]) any/c - "Returns " (to-element 'equiv) (mz-examples (name example))))))])) + "Returns " (to-element 'equiv) (mz-examples example)))))])) @title[#:tag "pairs"]{Pairs and Lists} diff --git a/collects/scribblings/reference/regexps.scrbl b/collects/scribblings/reference/regexps.scrbl index 531149ef53..53d418025b 100644 --- a/collects/scribblings/reference/regexps.scrbl +++ b/collects/scribblings/reference/regexps.scrbl @@ -22,13 +22,13 @@ matching character streams; if a byte regexp is used with a character string, it matches bytes in the UTF-8 encoding of the string. Regular expressions can be compiled into a @deftech{regexp value} for -repeated matches. The @scheme[regexp] and @scheme[byte-regexp] +repeated matches. The @racket[regexp] and @racket[byte-regexp] procedures convert a string or byte string (respectively) into a regexp value using one syntax of regular expressions that is most -compatible to @exec{egrep}. The @scheme[pregexp] and -@scheme[byte-pregexp] procedures produce a regexp value using a +compatible to @exec{egrep}. The @racket[pregexp] and +@racket[byte-pregexp] procedures produce a regexp value using a slightly different syntax of regular expressions that is more -compatible with Perl. In addition, Scheme constants written with +compatible with Perl. In addition, Racket constants written with @litchar{#rx} or @litchar{#px} (see @secref["reader"]) produce compiled regexp values. @@ -43,22 +43,22 @@ The following syntax specifications describe the content of a string that represents a regular expression. The syntax of the corresponding string may involve extra escape characters. For example, the regular expression @litchar{(.*)\1} can be represented with the string -@scheme["(.*)\\1"] or the regexp constant @scheme[#rx"(.*)\\1"]; the +@racket["(.*)\\1"] or the regexp constant @racket[#rx"(.*)\\1"]; the @litchar{\} in the regular expression must be escaped to include it in a string or regexp constant. -The @scheme[regexp] and @scheme[pregexp] syntaxes share a common core: +The @racket[regexp] and @racket[pregexp] syntaxes share a common core: @common-table -The following completes the grammar for @scheme[regexp], which treats +The following completes the grammar for @racket[regexp], which treats @litchar["{"] and @litchar["}"] as literals, @litchar{\} as a literal within ranges, and @litchar{\} as a literal producer outside of ranges. @rx-table -The following completes the grammar for @scheme[pregexp], which uses +The following completes the grammar for @racket[pregexp], which uses @litchar["{"] and @litchar["}"] bounded repetition and uses @litchar{\} for meta-characters both inside and outside of ranges. @@ -101,26 +101,26 @@ arbitrarily large sequence). @defproc[(regexp? [v any/c]) boolean?]{ -Returns @scheme[#t] if @scheme[v] is a @tech{regexp value} created by -@scheme[regexp] or @scheme[pregexp], @scheme[#f] otherwise.} +Returns @racket[#t] if @racket[v] is a @tech{regexp value} created by +@racket[regexp] or @racket[pregexp], @racket[#f] otherwise.} @defproc[(pregexp? [v any/c]) boolean?]{ -Returns @scheme[#t] if @scheme[v] is a @tech{regexp value} created by -@scheme[pregexp] (not @scheme[regexp]), @scheme[#f] otherwise.} +Returns @racket[#t] if @racket[v] is a @tech{regexp value} created by +@racket[pregexp] (not @racket[regexp]), @racket[#f] otherwise.} @defproc[(byte-regexp? [v any/c]) boolean?]{ -Returns @scheme[#t] if @scheme[v] is a @tech{regexp value} created by -@scheme[byte-regexp] or @scheme[byte-pregexp], @scheme[#f] otherwise.} +Returns @racket[#t] if @racket[v] is a @tech{regexp value} created by +@racket[byte-regexp] or @racket[byte-pregexp], @racket[#f] otherwise.} @defproc[(byte-pregexp? [v any/c]) boolean?]{ -Returns @scheme[#t] if @scheme[v] is a @tech{regexp value} created by -@scheme[byte-pregexp] (not @scheme[byte-regexp]), @scheme[#f] +Returns @racket[#t] if @racket[v] is a @tech{regexp value} created by +@racket[byte-pregexp] (not @racket[byte-regexp]), @racket[#f] otherwise.} @@ -134,7 +134,7 @@ is used multiple times, it is faster to compile the string once to a @tech{regexp value} and use it for repeated matches instead of using the string each time. -The @scheme[object-name] procedure returns +The @racket[object-name] procedure returns the source string for a @tech{regexp value}. @examples[ @@ -144,10 +144,10 @@ the source string for a @tech{regexp value}. @defproc[(pregexp [string string?]) pregexp?]{ -Like @scheme[regexp], except that it uses a slightly different syntax +Like @racket[regexp], except that it uses a slightly different syntax (see @secref["regexp-syntax"]). The result can be used with -@scheme[regexp-match], etc., just like the result from -@scheme[regexp]. +@racket[regexp-match], etc., just like the result from +@racket[regexp]. @examples[ (pregexp "ap*le") @@ -160,7 +160,7 @@ Takes a byte-string representation of a regular expression (using the syntax in @secref["regexp-syntax"]) and compiles it into a byte-@tech{regexp value}. -The @scheme[object-name] procedure +The @racket[object-name] procedure returns the source byte string for a @tech{regexp value}. @examples[ @@ -171,10 +171,10 @@ returns the source byte string for a @tech{regexp value}. @defproc[(byte-pregexp [bstr bytes?]) byte-pregexp?]{ -Like @scheme[byte-regexp], except that it uses a slightly different +Like @racket[byte-regexp], except that it uses a slightly different syntax (see @secref["regexp-syntax"]). The result can be used with -@scheme[regexp-match], etc., just like the result from -@scheme[byte-regexp]. +@racket[regexp-match], etc., just like the result from +@racket[byte-regexp]. @examples[ (byte-pregexp #"ap*le") @@ -183,11 +183,11 @@ syntax (see @secref["regexp-syntax"]). The result can be used with @defproc*[([(regexp-quote [str string?] [case-sensitive? any/c #t]) string?] [(regexp-quote [bstr bytes?] [case-sensitive? any/c #t]) bytes?])]{ -Produces a string or byte string suitable for use with @scheme[regexp] -to match the literal sequence of characters in @scheme[str] or -sequence of bytes in @scheme[bstr]. If @scheme[case-sensitive?] is -true, the resulting regexp matches letters in @scheme[str] or -@scheme[bytes] case-insensitively, otherwise it matches +Produces a string or byte string suitable for use with @racket[regexp] +to match the literal sequence of characters in @racket[str] or +sequence of bytes in @racket[bstr]. If @racket[case-sensitive?] is +true, the resulting regexp matches letters in @racket[str] or +@racket[bytes] case-insensitively, otherwise it matches case-sensitively. @examples[ @@ -198,7 +198,7 @@ case-sensitively. @defproc[(regexp-max-lookbehind [pattern (or/c regexp? byte-regexp?)]) exact-nonnegative-integer?]{ -Returns the maximum number of bytes that @scheme[pattern] may consult +Returns the maximum number of bytes that @racket[pattern] may consult before the starting position of a match to determine the match. For example, the pattern @litchar{(?<=abc)d} consults three bytes preceding a matching @litchar{d}, while @litchar{e(?<=a..)d} consults @@ -220,93 +220,93 @@ the start of the input or of a line.} (or/c #f (cons/c string? (listof (or/c string? #f)))) (or/c #f (cons/c bytes? (listof (or/c bytes? #f)))))]{ -Attempts to match @scheme[pattern] (a string, byte string, @tech{regexp -value}, or byte-@tech{regexp value}) once to a portion of @scheme[input]. The -matcher finds a portion of @scheme[input] that matches and is closest -to the start of the input (after @scheme[start-pos]). +Attempts to match @racket[pattern] (a string, byte string, @tech{regexp +value}, or byte-@tech{regexp value}) once to a portion of @racket[input]. The +matcher finds a portion of @racket[input] that matches and is closest +to the start of the input (after @racket[start-pos]). -The optional @scheme[start-pos] and @scheme[end-pos] arguments select -a portion of @scheme[input] for matching; the default is the entire -string or the stream up to an end-of-file. When @scheme[input] is a -string, @scheme[start-pos] is a character position; when -@scheme[input] is a byte string, then @scheme[start-pos] is a byte -position; and when @scheme[input] is an input port, @scheme[start-pos] +The optional @racket[start-pos] and @racket[end-pos] arguments select +a portion of @racket[input] for matching; the default is the entire +string or the stream up to an end-of-file. When @racket[input] is a +string, @racket[start-pos] is a character position; when +@racket[input] is a byte string, then @racket[start-pos] is a byte +position; and when @racket[input] is an input port, @racket[start-pos] is the number of bytes to skip before starting to match. The -@scheme[end-pos] argument can be @scheme[#f], which corresponds to the +@racket[end-pos] argument can be @racket[#f], which corresponds to the end of the string or the end-of-file in the stream; otherwise, it is a -character or byte position, like @scheme[start-pos]. If @scheme[input] +character or byte position, like @racket[start-pos]. If @racket[input] is an input port, and if the end-of-file is reached before -@scheme[start-pos] bytes are skipped, then the match fails. +@racket[start-pos] bytes are skipped, then the match fails. -In @scheme[pattern], a start-of-string @litchar{^} refers to the first -position of @scheme[input] after @scheme[start-pos], assuming that -@scheme[input-prefix] is @scheme[#""]. The end-of-input @litchar{$} -refers to the @scheme[end-pos]th position or (in the case of an input +In @racket[pattern], a start-of-string @litchar{^} refers to the first +position of @racket[input] after @racket[start-pos], assuming that +@racket[input-prefix] is @racket[#""]. The end-of-input @litchar{$} +refers to the @racket[end-pos]th position or (in the case of an input port) the end of file, whichever comes first, assuming that -@scheme[output-prefix] is @scheme[#f]. +@racket[output-prefix] is @racket[#f]. -The @scheme[input-prefix] specifies bytes that effectively precede -@scheme[input] for the purposes of @litchar{^} and other look-behind -matching. For example, a @scheme[#""] prefix means that @litchar{^} -matches at the beginning of the stream, while a @scheme[#"\n"] -@scheme[input-prefix] means that a start-of-line @litchar{^} can match +The @racket[input-prefix] specifies bytes that effectively precede +@racket[input] for the purposes of @litchar{^} and other look-behind +matching. For example, a @racket[#""] prefix means that @litchar{^} +matches at the beginning of the stream, while a @racket[#"\n"] +@racket[input-prefix] means that a start-of-line @litchar{^} can match the beginning of the input, while a start-of-file @litchar{^} cannot. -If the match fails, @scheme[#f] is returned. If the match succeeds, a -list containing strings or byte string, and possibly @scheme[#f], is -returned. The list contains strings only if @scheme[input] is a string -and @scheme[pattern] is not a byte regexp. Otherwise, the list +If the match fails, @racket[#f] is returned. If the match succeeds, a +list containing strings or byte string, and possibly @racket[#f], is +returned. The list contains strings only if @racket[input] is a string +and @racket[pattern] is not a byte regexp. Otherwise, the list contains byte strings (substrings of the UTF-8 encoding of -@scheme[input], if @scheme[input] is a string). +@racket[input], if @racket[input] is a string). The first [byte] string in a result list is the portion of -@scheme[input] that matched @scheme[pattern]. If two portions of -@scheme[input] can match @scheme[pattern], then the match that starts +@racket[input] that matched @racket[pattern]. If two portions of +@racket[input] can match @racket[pattern], then the match that starts earliest is found. -Additional [byte] strings are returned in the list if @scheme[pattern] +Additional [byte] strings are returned in the list if @racket[pattern] contains parenthesized sub-expressions (but not when the open parenthesis is followed by @litchar{?:}). Matches for the sub-expressions are provided in the order of the opening parentheses -in @scheme[pattern]. When sub-expressions occur in branches of an +in @racket[pattern]. When sub-expressions occur in branches of an @litchar{|} ``or'' pattern, in a @litchar{*} ``zero or more'' pattern, or other places where the overall pattern can succeed without -a match for the sub-expression, then a @scheme[#f] is returned for the +a match for the sub-expression, then a @racket[#f] is returned for the sub-expression if it did not contribute to the final match. When a single sub-expression occurs within a @litchar{*} ``zero or more'' pattern or other multiple-match positions, then the rightmost match associated with the sub-expression is returned in the list. -If the optional @scheme[output-port] is provided as an output port, -the part of @scheme[input] from its beginning (not @scheme[start-pos]) -that precedes the match is written to the port. All of @scheme[input] -up to @scheme[end-pos] is written to the port if no match is -found. This functionality is most useful when @scheme[input] is an +If the optional @racket[output-port] is provided as an output port, +the part of @racket[input] from its beginning (not @racket[start-pos]) +that precedes the match is written to the port. All of @racket[input] +up to @racket[end-pos] is written to the port if no match is +found. This functionality is most useful when @racket[input] is an input port. When matching an input port, a match failure reads up to -@scheme[end-pos] bytes (or end-of-file), even if @scheme[pattern] +@racket[end-pos] bytes (or end-of-file), even if @racket[pattern] begins with a start-of-string @litchar{^}; see also -@scheme[regexp-try-match]. On success, all bytes up to and including +@racket[regexp-try-match]. On success, all bytes up to and including the match are eventually read from the port, but matching proceeds by -first peeking bytes from the port (using @scheme[peek-bytes-avail!]), +first peeking bytes from the port (using @racket[peek-bytes-avail!]), and then (re-)reading matching bytes to discard them after the match result is determined. Non-matching bytes may be read and discarded before the match is determined. The matcher peeks in blocking mode only as far as necessary to determine a match, but it may peek extra bytes to fill an internal buffer if immediately available (i.e., -without blocking). Greedy repeat operators in @scheme[pattern], such +without blocking). Greedy repeat operators in @racket[pattern], such as @litchar{*} or @litchar{+}, tend to force reading the entire -content of the port (up to @scheme[end-pos]) to determine a match. +content of the port (up to @racket[end-pos]) to determine a match. If the input port is read simultaneously by another thread, or if the port is a custom port with inconsistent reading and peeking procedures (see @secref["customport"]), then the bytes that are peeked and used for matching may be different than the bytes read and discarded after the match completes; the matcher inspects only the peeked -bytes. To avoid such interleaving, use @scheme[regexp-match-peek] -(with a @scheme[progress-evt] argument) followed by -@scheme[port-commit-peeked]. +bytes. To avoid such interleaving, use @racket[regexp-match-peek] +(with a @racket[progress-evt] argument) followed by +@racket[port-commit-peeked]. @examples[ (regexp-match #rx"x." "12x4x6") @@ -329,27 +329,27 @@ bytes. To avoid such interleaving, use @scheme[regexp-match-peek] (listof string?) (listof bytes?))]{ -Like @scheme[regexp-match], but the result is a list of strings or +Like @racket[regexp-match], but the result is a list of strings or byte strings corresponding to a sequence of matches of -@scheme[pattern] in @scheme[input]. (Unlike @scheme[regexp-match], -results for parenthesized sub-patterns in @scheme[pattern] are not +@racket[pattern] in @racket[input]. (Unlike @racket[regexp-match], +results for parenthesized sub-patterns in @racket[pattern] are not returned.) -The @scheme[pattern] is used in order to find matches, where each +The @racket[pattern] is used in order to find matches, where each match attempt starts at the end of the last match, and @litchar{^} is -allowed to match the beginning of the input (if @scheme[input-prefix] -is @scheme[#""]) only for the first match. Empty matches are handled +allowed to match the beginning of the input (if @racket[input-prefix] +is @racket[#""]) only for the first match. Empty matches are handled like other matches, returning a zero-length string or byte sequence -(they are more useful in the complementing @scheme[regexp-split] -function), but @scheme[pattern] is restricted from matching an empty +(they are more useful in the complementing @racket[regexp-split] +function), but @racket[pattern] is restricted from matching an empty sequence immediately after an empty match. -If @scheme[input] contains no matches (in the range @scheme[start-pos] -to @scheme[end-pos]), @scheme[null] is returned. Otherwise, each item +If @racket[input] contains no matches (in the range @racket[start-pos] +to @racket[end-pos]), @racket[null] is returned. Otherwise, each item in the resulting list is a distinct substring or byte sequence from -@scheme[input] that matches @scheme[pattern]. The @scheme[end-pos] -argument can be @scheme[#f] to match to the end of @scheme[input] -(which corresponds to an end-of-file if @scheme[input] is an input +@racket[input] that matches @racket[pattern]. The @racket[end-pos] +argument can be @racket[#f] to match to the end of @racket[input] +(which corresponds to an end-of-file if @racket[input] is an input port). @examples[ @@ -369,12 +369,12 @@ port). (or/c #f (cons/c string? (listof (or/c string? #f)))) (or/c #f (cons/c bytes? (listof (or/c bytes? #f)))))]{ -Like @scheme[regexp-match] on input ports, except that if the match -fails, no characters are read and discarded from @scheme[in]. +Like @racket[regexp-match] on input ports, except that if the match +fails, no characters are read and discarded from @racket[in]. -This procedure is especially useful with a @scheme[pattern] that -begins with a start-of-string @litchar{^} or with a non-@scheme[#f] -@scheme[end-pos], since each limits the amount of peeking into the +This procedure is especially useful with a @racket[pattern] that +begins with a start-of-string @litchar{^} or with a non-@racket[#f] +@racket[end-pos], since each limits the amount of peeking into the port. Otherwise, beware that a large portion of the stream may be peeked (and therefore pulled into memory) before the match succeeds or fails.} @@ -393,19 +393,19 @@ fails.} #f))) #f)]{ -Like @scheme[regexp-match], but returns a list of number pairs (and -@scheme[#f]) instead of a list of strings. Each pair of numbers refers -to a range of characters or bytes in @scheme[input]. If the result for -the same arguments with @scheme[regexp-match] would be a list of byte +Like @racket[regexp-match], but returns a list of number pairs (and +@racket[#f]) instead of a list of strings. Each pair of numbers refers +to a range of characters or bytes in @racket[input]. If the result for +the same arguments with @racket[regexp-match] would be a list of byte strings, the resulting ranges correspond to byte ranges; in that case, -if @scheme[input] is a character string, the byte ranges correspond to +if @racket[input] is a character string, the byte ranges correspond to bytes in the UTF-8 encoding of the string. -Range results are returned in a @scheme[substring]- and -@scheme[subbytes]-compatible manner, independent of -@scheme[start-pos]. In the case of an input port, the returned +Range results are returned in a @racket[substring]- and +@racket[subbytes]-compatible manner, independent of +@racket[start-pos]. In the case of an input port, the returned positions indicate the number of bytes that were read, including -@scheme[start-pos], before the first matching byte. +@racket[start-pos], before the first matching byte. @examples[ (regexp-match-positions #rx"x." "12x4x6") @@ -421,8 +421,8 @@ positions indicate the number of bytes that were read, including (listof (cons/c exact-nonnegative-integer? exact-nonnegative-integer?))]{ -Like @scheme[regexp-match-positions], but returns multiple matches -like @scheme[regexp-match*]. +Like @racket[regexp-match-positions], but returns multiple matches +like @racket[regexp-match*]. @examples[ (regexp-match-positions #rx"x." "12x4x6") @@ -437,8 +437,8 @@ like @scheme[regexp-match*]. [input-prefix bytes? #""]) boolean?]{ -Like @scheme[regexp-match], but returns merely @scheme[#t] when the -match succeeds, @scheme[#f] otherwise. +Like @racket[regexp-match], but returns merely @racket[#t] when the +match succeeds, @racket[#f] otherwise. @examples[ (regexp-match? #rx"x." "12x4x6") @@ -450,8 +450,8 @@ match succeeds, @scheme[#f] otherwise. [input (or/c string? bytes? input-port?)]) boolean?]{ -Like @scheme[regexp-match?], but @scheme[#t] is only returned when the -entire content of @scheme[input] matches @scheme[pattern]. +Like @racket[regexp-match?], but @racket[#t] is only returned when the +entire content of @racket[input] matches @racket[pattern]. @examples[ (regexp-match-exact? #rx"x." "12x4x6") @@ -468,15 +468,15 @@ entire content of @scheme[input] matches @scheme[pattern]. (or/c (cons/c bytes? (listof (or/c bytes? #f))) #f)]{ -Like @scheme[regexp-match] on input ports, but only peeks bytes from -@scheme[input] instead of reading them. Furthermore, instead of +Like @racket[regexp-match] on input ports, but only peeks bytes from +@racket[input] instead of reading them. Furthermore, instead of an output port, the last optional argument is a progress event for -@scheme[input] (see @scheme[port-progress-evt]). If @scheme[progress] -becomes ready, then the match stops peeking from @scheme[input] -and returns @scheme[#f]. The @scheme[progress] argument can be -@scheme[#f], in which case the peek may continue with inconsistent +@racket[input] (see @racket[port-progress-evt]). If @racket[progress] +becomes ready, then the match stops peeking from @racket[input] +and returns @racket[#f]. The @racket[progress] argument can be +@racket[#f], in which case the peek may continue with inconsistent information if another process meanwhile reads from -@scheme[input]. +@racket[input]. @examples[ (define p (open-input-string "a abcd")) @@ -502,9 +502,9 @@ information if another process meanwhile reads from #f))) #f)]{ -Like @scheme[regexp-match-positions] on input ports, but only peeks -bytes from @scheme[input] instead of reading them, and with a -@scheme[progress] argument like @scheme[regexp-match-peek].} +Like @racket[regexp-match-positions] on input ports, but only peeks +bytes from @racket[input] instead of reading them, and with a +@racket[progress] argument like @racket[regexp-match-peek].} @defproc[(regexp-match-peek-immediate [pattern (or/c string? bytes? regexp? byte-regexp?)] @@ -516,10 +516,10 @@ bytes from @scheme[input] instead of reading them, and with a (or/c (cons/c bytes? (listof (or/c bytes? #f))) #f)]{ -Like @scheme[regexp-match-peek], but it attempts to match only bytes -that are available from @scheme[input] without blocking. The +Like @racket[regexp-match-peek], but it attempts to match only bytes +that are available from @racket[input] without blocking. The match fails if not-yet-available characters might be used to match -@scheme[pattern].} +@racket[pattern].} @defproc[(regexp-match-peek-positions-immediate [pattern (or/c string? bytes? regexp? byte-regexp?)] @@ -535,10 +535,10 @@ match fails if not-yet-available characters might be used to match #f))) #f)]{ -Like @scheme[regexp-match-peek-positions], but it attempts to match -only bytes that are available from @scheme[input] without +Like @racket[regexp-match-peek-positions], but it attempts to match +only bytes that are available from @racket[input] without blocking. The match fails if not-yet-available characters might be -used to match @scheme[pattern].} +used to match @racket[pattern].} @defproc[(regexp-match-peek-positions* [pattern (or/c string? bytes? regexp? byte-regexp?)] @@ -549,8 +549,8 @@ used to match @scheme[pattern].} (listof (cons/c exact-nonnegative-integer? exact-nonnegative-integer?))]{ -Like @scheme[regexp-match-peek-positions], but returns multiple matches like -@scheme[regexp-match*].} +Like @racket[regexp-match-peek-positions], but returns multiple matches like +@racket[regexp-match*].} @defproc[(regexp-match/end [pattern (or/c string? bytes? regexp? byte-regexp?)] [input (or/c string? bytes? input-port?)] @@ -566,15 +566,15 @@ Like @scheme[regexp-match-peek-positions], but returns multiple matches like (or/c #f (cons/c bytes? (listof (or/c bytes? #f))))) (or/c #f bytes?))]{ -Like @scheme[regexp-match], but with a second result: a byte -string of up to @scheme[count] bytes that correspond to the input -(possibly including the @scheme[input-prefix]) leading to the end of -the match; the second result is @scheme[#f] if no match is found. +Like @racket[regexp-match], but with a second result: a byte +string of up to @racket[count] bytes that correspond to the input +(possibly including the @racket[input-prefix]) leading to the end of +the match; the second result is @racket[#f] if no match is found. -The second result can be useful as an @scheme[input-prefix] for -attempting a second match on @scheme[input] starting from the end of -the first match. In that case, use @scheme[regexp-max-lookbehind] -to determine an appropriate value for @scheme[count].} +The second result can be useful as an @racket[input-prefix] for +attempting a second match on @racket[input] starting from the end of +the first match. In that case, use @racket[regexp-max-lookbehind] +to determine an appropriate value for @racket[count].} @deftogether[( @defproc[(regexp-match-positions/end [pattern (or/c string? bytes? regexp? byte-regexp?)] @@ -618,8 +618,8 @@ to determine an appropriate value for @scheme[count].} (or/c #f bytes?))] )]{ -Like @scheme[regexp-match-positions], etc., but with a second result -like @scheme[regexp-match/end].} +Like @racket[regexp-match-positions], etc., but with a second result +like @racket[regexp-match/end].} @;------------------------------------------------------------------------ @section{Regexp Splitting} @@ -634,24 +634,24 @@ like @scheme[regexp-match/end].} (cons/c string? (listof string?)) (cons/c bytes? (listof bytes?)))]{ -The complement of @scheme[regexp-match*]: the result is a list of -strings (if @scheme[pattern] is a string or character regexp and -@scheme[input] is a string) or byte strings (otherwise) from in -@scheme[input] that are separated by matches to -@scheme[pattern]. Adjacent matches are separated with @scheme[""] or -@scheme[#""]. Zero-length matches are treated the same as for -@scheme[regexp-match*]. +The complement of @racket[regexp-match*]: the result is a list of +strings (if @racket[pattern] is a string or character regexp and +@racket[input] is a string) or byte strings (otherwise) from in +@racket[input] that are separated by matches to +@racket[pattern]. Adjacent matches are separated with @racket[""] or +@racket[#""]. Zero-length matches are treated the same as for +@racket[regexp-match*]. -If @scheme[input] contains no matches (in the range @scheme[start-pos] -to @scheme[end-pos]), the result is a list containing @scheme[input]'s -content (from @scheme[start-pos] to @scheme[end-pos]) as a single -element. If a match occurs at the beginning of @scheme[input] (at -@scheme[start-pos]), the resulting list will start with an empty +If @racket[input] contains no matches (in the range @racket[start-pos] +to @racket[end-pos]), the result is a list containing @racket[input]'s +content (from @racket[start-pos] to @racket[end-pos]) as a single +element. If a match occurs at the beginning of @racket[input] (at +@racket[start-pos]), the resulting list will start with an empty string or byte string, and if a match occurs at the end (at -@scheme[end-pos]), the list will end with an empty string or byte -string. The @scheme[end-pos] argument can be @scheme[#f], in which -case splitting goes to the end of @scheme[input] (which corresponds to -an end-of-file if @scheme[input] is an input port). +@racket[end-pos]), the list will end with an empty string or byte +string. The @racket[end-pos] argument can be @racket[#f], in which +case splitting goes to the end of @racket[input] (which corresponds to +an end-of-file if @racket[input] is an input port). @examples[ (regexp-split #rx" +" "12 34") @@ -675,52 +675,52 @@ an end-of-file if @scheme[input] is an input port). string? bytes?)]{ -Performs a match using @scheme[pattern] on @scheme[input], and then +Performs a match using @racket[pattern] on @racket[input], and then returns a string or byte string in which the matching portion of -@scheme[input] is replaced with @scheme[insert]. If @scheme[pattern] -matches no part of @scheme[input], then @scheme[iput] is returned +@racket[input] is replaced with @racket[insert]. If @racket[pattern] +matches no part of @racket[input], then @racket[iput] is returned unmodified. -The @scheme[insert] argument can be either a (byte) string, or a +The @racket[insert] argument can be either a (byte) string, or a function that returns a (byte) string. In the latter case, the -function is applied on the list of values that @scheme[regexp-match] +function is applied on the list of values that @racket[regexp-match] would return (i.e., the first argument is the complete match, and then one argument for each parenthesized sub-expression) to obtain a replacement (byte) string. -If @scheme[pattern] is a string or character regexp and @scheme[input] -is a string, then @scheme[insert] must be a string or a procedure that -accept strings, and the result is a string. If @scheme[pattern] is a -byte string or byte regexp, or if @scheme[input] is a byte string, -then @scheme[insert] as a string is converted to a byte string, -@scheme[insert] as a procedure is called with a byte string, and the +If @racket[pattern] is a string or character regexp and @racket[input] +is a string, then @racket[insert] must be a string or a procedure that +accept strings, and the result is a string. If @racket[pattern] is a +byte string or byte regexp, or if @racket[input] is a byte string, +then @racket[insert] as a string is converted to a byte string, +@racket[insert] as a procedure is called with a byte string, and the result is a byte string. -If @scheme[insert] contains @litchar{&}, then @litchar{&} -is replaced with the matching portion of @scheme[input] before it is -substituted into the match's place. If @scheme[insert] contains +If @racket[insert] contains @litchar{&}, then @litchar{&} +is replaced with the matching portion of @racket[input] before it is +substituted into the match's place. If @racket[insert] contains @litchar{\}@nonterm{n} for some integer @nonterm{n}, then it is replaced with the @nonterm{n}th matching sub-expression from -@scheme[input]. A @litchar{&} and @litchar{\0} are synonymous. If +@racket[input]. A @litchar{&} and @litchar{\0} are synonymous. If the @nonterm{n}th sub-expression was not used in the match, or if @nonterm{n} is greater than the number of sub-expressions in -@scheme[pattern], then @litchar{\}@nonterm{n} is replaced with the +@racket[pattern], then @litchar{\}@nonterm{n} is replaced with the empty string. To substitute a literal @litchar{&} or @litchar{\}, use @litchar{\&} and @litchar{\\}, respectively, in -@scheme[insert]. A @litchar{\$} in @scheme[insert] is +@racket[insert]. A @litchar{\$} in @racket[insert] is equivalent to an empty sequence; this can be used to terminate a number @nonterm{n} following @litchar{\}. If a @litchar{\} in -@scheme[insert] is followed by anything other than a digit, +@racket[insert] is followed by anything other than a digit, @litchar{&}, @litchar{\}, or @litchar{$}, then the @litchar{\} by itself is treated as @litchar{\0}. Note that the @litchar{\} described in the previous paragraphs is a -character or byte of @scheme[input]. To write such an @scheme[input] -as a Scheme string literal, an escaping @litchar{\} is needed -before the @litchar{\}. For example, the Scheme constant -@scheme["\\1"] is @litchar{\1}. +character or byte of @racket[input]. To write such an @racket[input] +as a Racket string literal, an escaping @litchar{\} is needed +before the @litchar{\}. For example, the Racket constant +@racket["\\1"] is @litchar{\1}. @examples[ (regexp-replace "mi" "mi casa" "su") @@ -740,13 +740,13 @@ before the @litchar{\}. For example, the Scheme constant [input-prefix bytes? #""]) (or/c string? bytes?)]{ -Like @scheme[regexp-replace], except that every instance of -@scheme[pattern] in @scheme[input] is replaced with @scheme[insert], +Like @racket[regexp-replace], except that every instance of +@racket[pattern] in @racket[input] is replaced with @racket[insert], instead of just the first match. Only non-overlapping instances of -@scheme[pattern] in @scheme[input] are replaced, so instances of -@scheme[pattern] within inserted strings are @italic{not} replaced +@racket[pattern] in @racket[input] are replaced, so instances of +@racket[pattern] within inserted strings are @italic{not} replaced recursively. Zero-length matches are treated the same as in -@scheme[regexp-match*]. +@racket[regexp-match*]. @examples[ (regexp-replace* "([Mm])i ([a-zA-Z]*)" "mi cerveza Mi Mi Mi" @@ -762,10 +762,10 @@ recursively. Zero-length matches are treated the same as in [(regexp-replace-quote [bstr bytes?]) bytes?])]{ Produces a string suitable for use as the third argument to -@scheme[regexp-replace] to insert the literal sequence of characters -in @scheme[str] or bytes in @scheme[bstr] as a replacement. -Concretely, every @litchar{\} and @litchar{&} in @scheme[str] or -@scheme[bstr] is protected by a quoting @litchar{\}. +@racket[regexp-replace] to insert the literal sequence of characters +in @racket[str] or bytes in @racket[bstr] as a replacement. +Concretely, every @litchar{\} and @litchar{&} in @racket[str] or +@racket[bstr] is protected by a quoting @litchar{\}. @examples[ (regexp-replace "UT" "Go UT!" "A&M") diff --git a/collects/scribblings/reference/sequences.scrbl b/collects/scribblings/reference/sequences.scrbl index 5a97e8fb84..67f2711f5e 100644 --- a/collects/scribblings/reference/sequences.scrbl +++ b/collects/scribblings/reference/sequences.scrbl @@ -331,8 +331,9 @@ the generator runs out of values to yield, the last value it computed will be returned for future invocations of the generator. Generators can be safely nested. -Note: the first form must be @scheme[()], and in the future this will -hold argument names that are used in the initial generator call. +Note: The first form must be @scheme[()]. In the future, the +@scheme[()] position will hold argument names that are used for the +initial generator call. @examples[#:eval (generator-eval) (define g (generator () diff --git a/collects/tests/mzscheme/set.ss b/collects/tests/mzscheme/set.ss index 345ca82960..9632b1fb3f 100644 --- a/collects/tests/mzscheme/set.ss +++ b/collects/tests/mzscheme/set.ss @@ -50,6 +50,11 @@ (test #t set-member? (set-remove s 5) 3) (test #f set-member? (set-remove s 3) 3) + (test #t set-subset? s (set 1 3)) + (test #t set-subset? s (set 1 2 3)) + (test #f set-subset? s (set 1 4)) + (test #t set-subset? s (set)) + (test 3 set-count (set-union s)) (test 6 set-count (set-union s (set 3 4 5 6))) (test 6 set-count (set-union (set 3 4 5 6) s)) From 051282877eb2870e73dec80ed3a1a37cbd38b737 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 23 Apr 2010 17:15:40 -0600 Subject: [PATCH 20/43] fix drracket tools doc build --- collects/drscheme/tool-lib.ss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collects/drscheme/tool-lib.ss b/collects/drscheme/tool-lib.ss index 440b8387fe..8f8464faac 100644 --- a/collects/drscheme/tool-lib.ss +++ b/collects/drscheme/tool-lib.ss @@ -9,7 +9,7 @@ all of the names in the tools library, for use defining keybindings |# (require scheme/class scheme/gui/base - scheme/unit + (except-in scheme/unit struct) scheme/contract scheme/class From f4c08ccb089d9863214f5915fd867da7d6121b22 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Fri, 23 Apr 2010 17:36:55 -0400 Subject: [PATCH 21/43] Preserve the executable bit of the file --- collects/meta/props | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/collects/meta/props b/collects/meta/props index db0efc4fa0..877f328e1f 100644 --- a/collects/meta/props +++ b/collects/meta/props @@ -314,8 +314,9 @@ path/s is either such a string or a list of them. sub)))) (and (or (pair? (tree-subs tree)) (pair? (tree-props tree))) tree)) (let (;; temp file in the same directory => fail early if cannot write to it - ;; and make a rename possible - [temp (make-temporary-file (format "~a~~a" this-file))]) + ;; and make a rename possible; copy from this file to preserve being + ;; executable + [temp (make-temporary-file (format "~a~~a" this-file) this-file)]) (dynamic-wind void (lambda () From 72431fda2db3b0185d137c6d0ae24827b93c814e Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Fri, 23 Apr 2010 20:58:22 -0400 Subject: [PATCH 22/43] only warn when there is an invalid path when getting a prop --- collects/meta/props | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/collects/meta/props b/collects/meta/props index 877f328e1f..f75eb1dcdd 100644 --- a/collects/meta/props +++ b/collects/meta/props @@ -140,7 +140,7 @@ path/s is either such a string or a list of them. ;; need updating if more characters are allowed in the future. #rx"[^/.a-zA-Z0-9%_+-]") -(define (validate-path-string path-string who) +(define (validate-path-string path-string who [only-warn? #f]) (define (bad why) (error* who "invalid path argument, expecting a ~a, got: ~e" why path-string)) @@ -149,10 +149,12 @@ path/s is either such a string or a list of them. (regexp-match? rx:bad-path path-string)) (bad "relative `/'-delimited string, no `/' suffix, `//', `.', or `..'")) (when (regexp-match? rx:bad-pathchar path-string) - (error* who "invalid path argument, ~s is not allowed, got: ~e\n~a~a" - (regexp-match rx:bad-pathchar path-string) path-string - "(note: if paths with this character are needed, then this" - " script needs to be exteded to allow them)"))) + (if only-warn? + (warn "~s is a bad path argument" path-string) + (error* who "invalid path argument, ~s is not allowed, got: ~e\n~a~a" + (regexp-match rx:bad-pathchar path-string) path-string + "(note: if paths with this character are needed, then this" + " script needs to be exteded to allow them)")))) (define (parse-prop-string prop str who) (with-handlers ([exn? (lambda (e) @@ -162,7 +164,7 @@ path/s is either such a string or a list of them. (define (get-prop path-string prop-name [default get-prop] #:strict? [strict? #f] #:as-string? [as-string? #f]) - (validate-path-string path-string 'get-prop) + (validate-path-string path-string 'get-prop #t) ; no errors (let ([upchain ;; take the chain going up from the most specific node, so that ;; properties of a directory apply to subpaths From 76754c5443c83d76aea86d18279e25997626342f Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sat, 24 Apr 2010 06:52:21 -0600 Subject: [PATCH 23/43] set-subset? to subset? --- collects/racket/set.rkt | 8 ++++---- collects/scribblings/reference/sets.scrbl | 8 ++++---- collects/tests/mzscheme/set.ss | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/collects/racket/set.rkt b/collects/racket/set.rkt index 3dc363eb81..2d007c66c7 100644 --- a/collects/racket/set.rkt +++ b/collects/racket/set.rkt @@ -6,7 +6,7 @@ set-empty? set-count set-member? set-add set-remove set-union set-intersect set-subtract - set-subset? + subset? set-map set-for-each (rename-out [*in-set in-set]) for/set for/seteq for/seteqv @@ -164,9 +164,9 @@ (for/fold ([set set]) ([set2 (in-list sets)]) (set-subtract set set2))])) -(define (set-subset? set1 set2) - (unless (set? set1) (raise-type-error 'set-subset? "set" 0 set1 set2)) - (unless (set? set2) (raise-type-error 'set-subset? "set" 1 set1 set2)) +(define (subset? set2 set1) + (unless (set? set2) (raise-type-error 'subset? "set" 0 set2 set1)) + (unless (set? set1) (raise-type-error 'subset? "set" 0 set2 set1)) (let ([ht1 (set-ht set1)] [ht2 (set-ht set2)]) (unless (and (eq? (hash-eq? ht1) (hash-eq? ht2)) diff --git a/collects/scribblings/reference/sets.scrbl b/collects/scribblings/reference/sets.scrbl index a61ff00c9f..358ca31364 100644 --- a/collects/scribblings/reference/sets.scrbl +++ b/collects/scribblings/reference/sets.scrbl @@ -103,13 +103,13 @@ runs in time proportional to the total size of all given @scheme[set]s except the first one.} -@defproc[(set-subset? [set set?] [set2 set?]) boolean?]{ +@defproc[(subset? [set set?] [set2 set?]) boolean?]{ -Returns @scheme[#t] if every member of @scheme[set2] is in -@scheme[set], @scheme[#f] otherwise. The @scheme[set] and +Returns @scheme[#t] if every member of @scheme[set] is in +@scheme[set2], @scheme[#f] otherwise. The @scheme[set] and @scheme[set2] must use the same equivalence predicate (@scheme[equal?], @scheme[eq?], or @scheme[eqv?]). This operation -runs in time proportional to the size of @scheme[set2].} +runs in time proportional to the size of @scheme[set].} @defproc[(set-map [set set?] diff --git a/collects/tests/mzscheme/set.ss b/collects/tests/mzscheme/set.ss index 9632b1fb3f..1089b48cb2 100644 --- a/collects/tests/mzscheme/set.ss +++ b/collects/tests/mzscheme/set.ss @@ -50,10 +50,10 @@ (test #t set-member? (set-remove s 5) 3) (test #f set-member? (set-remove s 3) 3) - (test #t set-subset? s (set 1 3)) - (test #t set-subset? s (set 1 2 3)) - (test #f set-subset? s (set 1 4)) - (test #t set-subset? s (set)) + (test #t subset? (set 1 3) s) + (test #t subset? (set 1 2 3) s) + (test #f subset? (set 1 4) s) + (test #t subset? (set) s) (test 3 set-count (set-union s)) (test 6 set-count (set-union s (set 3 4 5 6))) From b0deb8affb817f971dafa8b8bcf658cd1ed4d878 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sat, 24 Apr 2010 06:52:49 -0600 Subject: [PATCH 24/43] more doc and scribble repairs --- collects/scribble/racket.ss | 8 +- collects/scribblings/reference/struct.scrbl | 378 ++++++++++---------- 2 files changed, 196 insertions(+), 190 deletions(-) diff --git a/collects/scribble/racket.ss b/collects/scribble/racket.ss index ab3a05ca64..397f359984 100644 --- a/collects/scribble/racket.ss +++ b/collects/scribble/racket.ss @@ -663,6 +663,11 @@ paren-color)) (set! src-col (+ src-col 3)) ((loop init-line! quote-depth qq?) (graph-defn-r (syntax-e c))))] + [(and (keyword? (syntax-e c)) qq?) + (advance c init-line!) + (let ([quote-depth (to-quoted "`" qq? quote-depth out color? inc-src-col)]) + (typeset-atom c out color? quote-depth qq?) + (set! src-col (+ src-col (or (syntax-span c) 1))))] [else (advance c init-line!) (typeset-atom c out color? quote-depth qq?) @@ -701,7 +706,8 @@ (graph-defn? s) (graph-reference? s) (struct-proxy? s) - (and qq? (identifier? c))) + (and qq? (or (identifier? c) + (keyword? (syntax-e c))))) (gen-typeset c multi-line? prefix1 prefix suffix color? qq?) (typeset-atom c (letrec ([mk diff --git a/collects/scribblings/reference/struct.scrbl b/collects/scribblings/reference/struct.scrbl index b5dc9e4a06..1d9ec7c195 100644 --- a/collects/scribblings/reference/struct.scrbl +++ b/collects/scribblings/reference/struct.scrbl @@ -6,7 +6,7 @@ @title[#:tag "structures" #:style 'toc]{Structures} -@guideintro["define-struct"]{structure types via @scheme[define-struct]} +@guideintro["define-struct"]{structure types via @racket[struct]} A @deftech{structure type} is a record datatype composing a number of @idefterm{fields}. A @deftech{structure}, an instance of a structure @@ -15,8 +15,8 @@ the structure type. A structure instance is created with a type-specific @tech{constructor} procedure, and its field values are accessed and changed with type-specific @tech{accessor} and @tech{mutator} procedures. In addition, each structure type has a -@tech{predicate} procedure that answers @scheme[#t] for instances of -the structure type and @scheme[#f] for any other value. +@tech{predicate} procedure that answers @racket[#t] for instances of +the structure type and @racket[#f] for any other value. A structure type's fields are essentially unnamed, though names are supported for error-reporting purposes. The constructor procedure @@ -49,7 +49,7 @@ accessed with subtype-specific selectors. Subtype-specific @tech{accessors} and @tech{mutators} for the first @math{m} fields do not exist. -The @scheme[define-struct] form and @scheme[make-struct-type] +The @racket[struct] form and @racket[make-struct-type] procedure typically create a new structure type, but they can also access @deftech{prefab} (i.e., previously fabricated) structure types that are globally shared, and whose instances can be parsed and @@ -65,15 +65,15 @@ field), and field mutability. @refalso["serialization"]{reading and writing structures} @index['("structures" "equality")]{Two} structure values are -@scheme[eqv?] if and only if they are @scheme[eq?]. Two structure -values are @scheme[equal?] if they are @scheme[eq?]. By default, two -structure values are also @scheme[equal?] if they are instances of the +@racket[eqv?] if and only if they are @racket[eq?]. Two structure +values are @racket[equal?] if they are @racket[eq?]. By default, two +structure values are also @racket[equal?] if they are instances of the same structure type, no fields are opaque, and the results of applying -@scheme[struct->vector] to the structs are -@scheme[equal?]. (Consequently, @scheme[equal?] testing for +@racket[struct->vector] to the structs are +@racket[equal?]. (Consequently, @racket[equal?] testing for structures may depend on the current inspector.) A structure type can -override the default @scheme[equal?] definition through the -@scheme[prop:equal+hash] property. +override the default @racket[equal?] definition through the +@racket[prop:equal+hash] property. @local-table-of-contents[] @@ -107,74 +107,74 @@ override the default @scheme[equal?] definition through the struct-accessor-procedure? struct-mutator-procedure?)]{ -Creates a new structure type, unless @scheme[inspector] is -@scheme['prefab], in which case @scheme[make-struct-type] accesses a -@techlink{prefab} structure type. The @scheme[name] argument is used -as the type name. If @scheme[super-type] is not @scheme[#f], the +Creates a new structure type, unless @racket[inspector] is +@racket['prefab], in which case @racket[make-struct-type] accesses a +@techlink{prefab} structure type. The @racket[name] argument is used +as the type name. If @racket[super-type] is not @racket[#f], the resulting type is a subtype of the corresponding structure type. The resulting structure type has -@math{@scheme[init-field-cnt]+@scheme[auto-field-cnt]} fields (in -addition to any fields from @scheme[super-type]), but only -@scheme[init-field-cnt] constructor arguments (in addition to any -constructor arguments from @scheme[super-type]). The remaining fields -are initialized with @scheme[auto-v]. The total field count (including -@scheme[super-type] fields) must be no more than 32768. +@math{@racket[init-field-cnt]+@racket[auto-field-cnt]} fields (in +addition to any fields from @racket[super-type]), but only +@racket[init-field-cnt] constructor arguments (in addition to any +constructor arguments from @racket[super-type]). The remaining fields +are initialized with @racket[auto-v]. The total field count (including +@racket[super-type] fields) must be no more than 32768. -The @scheme[props] argument is a list of pairs, where the @scheme[car] +The @racket[props] argument is a list of pairs, where the @racket[car] of each pair is a structure type property descriptor, and the -@scheme[cdr] is an arbitrary value. A property can be specified -multiple times in in @scheme[props] (including properties that are +@racket[cdr] is an arbitrary value. A property can be specified +multiple times in in @racket[props] (including properties that are automatically added by properties that are directly included in -@scheme[props]) only if the associated values are @scheme[eq?], +@racket[props]) only if the associated values are @racket[eq?], otherwise the @exnraise[exn:fail:contract]. See @secref["structprops"] -for more information about properties. When @scheme[inspector] is -@scheme['prefab], then @scheme[props] must be @scheme[null]. +for more information about properties. When @racket[inspector] is +@racket['prefab], then @racket[props] must be @racket[null]. -The @scheme[inspector] argument normally controls access to reflective +The @racket[inspector] argument normally controls access to reflective information about the structure type and its instances; see -@secref["inspectors"] for more information. If @scheme[inspector] is -@scheme['prefab], then the resulting @tech{prefab} structure type and +@secref["inspectors"] for more information. If @racket[inspector] is +@racket['prefab], then the resulting @tech{prefab} structure type and its instances are always transparent. -If @scheme[proc-spec] is an integer or procedure, instances of the -structure type act as procedures. See @scheme[prop:procedure] for -further information. Providing a non-@scheme[#f] value for -@scheme[proc-spec] is the same as pairing the value with -@scheme[prop:procedure] at the end of @scheme[props], plus including -@scheme[proc-spec] in @scheme[immutables] when @scheme[proc-spec] is +If @racket[proc-spec] is an integer or procedure, instances of the +structure type act as procedures. See @racket[prop:procedure] for +further information. Providing a non-@racket[#f] value for +@racket[proc-spec] is the same as pairing the value with +@racket[prop:procedure] at the end of @racket[props], plus including +@racket[proc-spec] in @racket[immutables] when @racket[proc-spec] is an integer. -The @scheme[immutables] argument provides a list of field +The @racket[immutables] argument provides a list of field positions. Each element in the list must be unique, otherwise @exnraise[exn:fail:contract]. Each element must also fall in the range -@scheme[0] (inclusive) to @scheme[init-field-cnt] (exclusive), otherwise +@racket[0] (inclusive) to @racket[init-field-cnt] (exclusive), otherwise @exnraise[exn:fail:contract]. -The @scheme[guard] argument is either a procedure of @math{n+1} -arguments or @scheme[#f], where @math{n} is the number of arguments +The @racket[guard] argument is either a procedure of @math{n+1} +arguments or @racket[#f], where @math{n} is the number of arguments for the new structure type's constructor (i.e., -@scheme[init-field-cnt] plus constructor arguments implied by -@scheme[super-type], if any). If @scheme[guard] is a procedure, then +@racket[init-field-cnt] plus constructor arguments implied by +@racket[super-type], if any). If @racket[guard] is a procedure, then the procedure is called whenever an instance of the type is constructed, or whenever an instance of a subtype is created. The -arguments to @scheme[guard] are the values provided for the +arguments to @racket[guard] are the values provided for the structure's first @math{n} fields, followed by the name of the -instantiated structure type (which is @scheme[name], unless a subtype -is instantiated). The @scheme[guard] result must be @math{n} values, +instantiated structure type (which is @racket[name], unless a subtype +is instantiated). The @racket[guard] result must be @math{n} values, which become the actual values for the structure's fields. The -@scheme[guard] can raise an exception to prevent creation of a +@racket[guard] can raise an exception to prevent creation of a structure with the given field values. If a structure subtype has its own guard, the subtype guard is applied first, and the first @math{n} values produced by the subtype's guard procedure become the first -@math{n} arguments to @scheme[guard]. When @scheme[inspector] is -@scheme['prefab], then @scheme[guard] must be @scheme[#f]. +@math{n} arguments to @racket[guard]. When @racket[inspector] is +@racket['prefab], then @racket[guard] must be @racket[#f]. -If @scheme[constructor-name] is not @scheme[#f], it is used as the +If @racket[constructor-name] is not @racket[#f], it is used as the name of the generated @tech{constructor} procedure as returned by -@scheme[object-name] or in the printed form of the constructor value. +@racket[object-name] or in the printed form of the constructor value. -The result of @scheme[make-struct-type] is five values: +The result of @racket[make-struct-type] is five values: @itemize[ @@ -186,7 +186,7 @@ The result of @scheme[make-struct-type] is five values: @item{an @tech{accessor} procedure, which consumes a structure and a field index between @math{0} (inclusive) and - @math{@scheme[init-field-cnt]+@scheme[auto-field-cnt]} (exclusive), + @math{@racket[init-field-cnt]+@racket[auto-field-cnt]} (exclusive), and} @item{a @tech{mutator} procedure, which consumes a structure, a field @@ -249,14 +249,14 @@ The result of @scheme[make-struct-type] is five values: (symbol->string (format "field~a" field-pos))]) procedure?]{ -Returns a field accessor that is equivalent to @scheme[(lambda (s) -(accessor-proc s field-pos))]. The @scheme[accessor-proc] must be -an @tech{accessor} returned by @scheme[make-struct-type]. The name of the +Returns a field accessor that is equivalent to @racket[(lambda (s) +(accessor-proc s field-pos))]. The @racket[accessor-proc] must be +an @tech{accessor} returned by @racket[make-struct-type]. The name of the resulting procedure for debugging purposes is derived from -@scheme[field-name] and the name of @scheme[accessor-proc]'s -structure type if @scheme[field-name] is a symbol. +@racket[field-name] and the name of @racket[accessor-proc]'s +structure type if @racket[field-name] is a symbol. -For examples, see @scheme[make-struct-type].} +For examples, see @racket[make-struct-type].} @defproc[(make-struct-field-mutator [mutator-proc struct-mutator-procedure?] [field-pos exact-nonnegative-integer?] @@ -264,14 +264,14 @@ For examples, see @scheme[make-struct-type].} (symbol->string (format "field~a" field-pos))]) procedure?]{ -Returns a field mutator that is equivalent to @scheme[(lambda (s v) -(mutator-proc s field-pos v))]. The @scheme[mutator-proc] must be -a @tech{mutator} returned by @scheme[make-struct-type]. The name of the +Returns a field mutator that is equivalent to @racket[(lambda (s v) +(mutator-proc s field-pos v))]. The @racket[mutator-proc] must be +a @tech{mutator} returned by @racket[make-struct-type]. The name of the resulting procedure for debugging purposes is derived from -@scheme[field-name] and the name of @scheme[mutator-proc]'s -structure type if @scheme[field-name] is a symbol. +@racket[field-name] and the name of @racket[mutator-proc]'s +structure type if @racket[field-name] is a symbol. -For examples, see @scheme[make-struct-type].} +For examples, see @racket[make-struct-type].} @;------------------------------------------------------------------------ @@ -281,9 +281,9 @@ A @deftech{structure type property} allows per-type information to be associated with a structure type (as opposed to per-instance information associated with a structure value). A property value is associated with a structure type through the - @scheme[make-struct-type] procedure (see - @secref["creatingmorestructs"]) or through the @scheme[#:property] - option of @scheme[define-struct]. Subtypes inherit the property + @racket[make-struct-type] procedure (see + @secref["creatingmorestructs"]) or through the @racket[#:property] + option of @racket[struct]. Subtypes inherit the property values of their parent types, and subtypes can override an inherited property value with a new value. @@ -301,12 +301,12 @@ Creates a new structure type property and returns three values: @itemize[ @item{a @deftech{structure type property descriptor}, for use with - @scheme[make-struct-type] and @scheme[define-struct];} + @racket[make-struct-type] and @racket[struct];} @item{a @deftech{property predicate} procedure, which takes an - arbitrary value and returns @scheme[#t] if the value is a + arbitrary value and returns @racket[#t] if the value is a descriptor or instance of a structure type that has a value for - the property, @scheme[#f] otherwise;} + the property, @racket[#f] otherwise;} @item{an @deftech{property accessor} procedure, which returns the value associated with the structure type given its descriptor or @@ -316,30 +316,30 @@ Creates a new structure type property and returns three values: ] -If the optional @scheme[guard] is supplied as a procedure, it is -called by @scheme[make-struct-type] before attaching the property to a -new structure type. The @scheme[guard] must accept two arguments: -a value for the property supplied to @scheme[make-struct-type], and a +If the optional @racket[guard] is supplied as a procedure, it is +called by @racket[make-struct-type] before attaching the property to a +new structure type. The @racket[guard] must accept two arguments: +a value for the property supplied to @racket[make-struct-type], and a list containing information about the new structure type. The list -contains the values that @scheme[struct-type-info] would return for +contains the values that @racket[struct-type-info] would return for the new structure type if it skipped the immediate current-inspector control check (but not the check for exposing an ancestor structure type, if any; see @secref["inspectors"]). -The result of calling @scheme[guard] is associated with the property +The result of calling @racket[guard] is associated with the property in the target structure type, instead of the value supplied to -@scheme[make-struct-type]. To reject a property association (e.g., -because the value supplied to @scheme[make-struct-type] is -inappropriate for the property), the @scheme[guard] can raise an -exception. Such an exception prevents @scheme[make-struct-type] from +@racket[make-struct-type]. To reject a property association (e.g., +because the value supplied to @racket[make-struct-type] is +inappropriate for the property), the @racket[guard] can raise an +exception. Such an exception prevents @racket[make-struct-type] from returning a structure type descriptor. -The optional @scheme[supers] argument is a list of properties that are +The optional @racket[supers] argument is a list of properties that are automatically associated with some structure type when the newly created property is associated to the structure type. Each property in -@scheme[supers] is paired with a procedure that receives the value +@racket[supers] is paired with a procedure that receives the value supplied for the new property (after it is processed by -@scheme[guard]) and returns a value for the associated property (which +@racket[guard]) and returns a value for the associated property (which is then sent to that property's guard, of any). @examples[ @@ -371,119 +371,119 @@ is then sent to that property's guard, of any). @defproc[(struct-type-property? [v any/c]) boolean?]{ -Returns @scheme[#t] if @scheme[v] is a @tech{structure type property -descriptor} value, @scheme[#f] otherwise.} +Returns @racket[#t] if @racket[v] is a @tech{structure type property +descriptor} value, @racket[#f] otherwise.} @defproc[(struct-type-property-accessor-procedure? [v any/c]) boolean?]{ -Returns @scheme[#t] if @scheme[v] is an accessor procedure produced -by @scheme[make-struct-type-property], @scheme[#f] otherwise.} +Returns @racket[#t] if @racket[v] is an accessor procedure produced +by @racket[make-struct-type-property], @racket[#f] otherwise.} @;------------------------------------------------------------------------ @section[#:tag "struct-copy"]{Copying and Updating Structures} @defform[(struct-copy id struct-expr [field-id expr] ...)]{ -Creates a new instance of the structure type @scheme[id] with the same -field values as the structure produced by @scheme[struct-expr], except -that the value of each supplied @scheme[field-id] is instead -determined by the corresponding @scheme[expr]. +Creates a new instance of the structure type @racket[id] with the same +field values as the structure produced by @racket[struct-expr], except +that the value of each supplied @racket[field-id] is instead +determined by the corresponding @racket[expr]. -The @scheme[id] must have a @tech{transformer binding} that +The @racket[id] must have a @tech{transformer binding} that encapsulates information about a structure type (i.e., like the -initial identifier bound by @scheme[define-struct]), and the binding +initial identifier bound by @racket[struct]), and the binding must supply a constructor, a predicate, and all field accessors. -Each @scheme[field-id] is combined with @scheme[id] to form -@scheme[id]@schemeidfont{-}@scheme[field-id] (using the lexical -context of @scheme[field-id]), which must be one of the accessor -bindings in @scheme[id]. The accessor bindings determined by different -@scheme[field-id]s must be distinct. The order of the -@scheme[field-id]s need not match the order of the corresponding +Each @racket[field-id] is combined with @racket[id] to form +@racket[id]@racketidfont{-}@racket[field-id] (using the lexical +context of @racket[field-id]), which must be one of the accessor +bindings in @racket[id]. The accessor bindings determined by different +@racket[field-id]s must be distinct. The order of the +@racket[field-id]s need not match the order of the corresponding fields in the structure type. -The @scheme[struct-expr] is evaluated first. The result must be an -instance of the @scheme[id] structure type, otherwise the -@exnraise[exn:fail:contract]. Next, the field @scheme[expr]s are +The @racket[struct-expr] is evaluated first. The result must be an +instance of the @racket[id] structure type, otherwise the +@exnraise[exn:fail:contract]. Next, the field @racket[expr]s are evaluated in order (even if the fields that correspond to the -@scheme[field-id]s are in a different order). Finally, the new +@racket[field-id]s are in a different order). Finally, the new structure instance is created. -The result of @scheme[struct-expr] can be an instance of a sub-type of -@scheme[id], but the resulting copy is an immediate instance of -@scheme[id] (not the sub-type).} +The result of @racket[struct-expr] can be an instance of a sub-type of +@racket[id], but the resulting copy is an immediate instance of +@racket[id] (not the sub-type).} @;------------------------------------------------------------------------ @section[#:tag "structutils"]{Structure Utilities} @defproc[(struct->vector [v any/c] [opaque-v any/c '...]) vector?]{ -Creates a vector representing @scheme[v]. The first slot of the +Creates a vector representing @racket[v]. The first slot of the result vector contains a symbol whose printed name has the form -@schemeidfont{struct:}@scheme[_id]. Each remaining slot contains -either the value of a field in @scheme[v], if it is accessible via the -current inspector, or @scheme[opaque-v] for a field that is not -accessible. A single @scheme[opaque-v] value is used in the vector for +@racketidfont{struct:}@racket[_id]. Each remaining slot contains +either the value of a field in @racket[v], if it is accessible via the +current inspector, or @racket[opaque-v] for a field that is not +accessible. A single @racket[opaque-v] value is used in the vector for contiguous inaccessible fields. (Consequently, the size of the vector -does not match the size of the @scheme[struct] if more than one field +does not match the size of the @racket[struct] if more than one field is inaccessible.)} -@defproc[(struct? [v any/c]) any]{ Returns @scheme[#t] if - @scheme[struct-info] exposes any structure types of @scheme[v] with - the current inspector, @scheme[#f] otherwise. +@defproc[(struct? [v any/c]) any]{ Returns @racket[#t] if + @racket[struct-info] exposes any structure types of @racket[v] with + the current inspector, @racket[#f] otherwise. - Typically, when @scheme[(struct? v)] is true, then - @scheme[(struct->vector v)] exposes at least one field value. It is - possible, however, for the only visible types of @scheme[v] to + Typically, when @racket[(struct? v)] is true, then + @racket[(struct->vector v)] exposes at least one field value. It is + possible, however, for the only visible types of @racket[v] to contribute zero fields.} -@defproc[(struct-type? [v any/c]) boolean?]{Returns @scheme[#t] if - @scheme[v] is a structure type descriptor value, @scheme[#f] +@defproc[(struct-type? [v any/c]) boolean?]{Returns @racket[#t] if + @racket[v] is a structure type descriptor value, @racket[#f] otherwise.} @defproc[(struct-constructor-procedure? [v any/c]) boolean?]{Returns - @scheme[#t] if @scheme[v] is a constructor procedure generated by - @scheme[define-struct] or @scheme[make-struct-type], @scheme[#f] + @racket[#t] if @racket[v] is a constructor procedure generated by + @racket[struct] or @racket[make-struct-type], @racket[#f] otherwise.} @defproc[(struct-predicate-procedure? [v any/c]) boolean?]{Returns - @scheme[#t] if @scheme[v] is a predicate procedure generated by - @scheme[define-struct] or @scheme[make-struct-type], @scheme[#f] + @racket[#t] if @racket[v] is a predicate procedure generated by + @racket[struct] or @racket[make-struct-type], @racket[#f] otherwise.} @defproc[(struct-accessor-procedure? [v any/c]) boolean?]{Returns - @scheme[#t] if @scheme[v] is an accessor procedure generated by - @scheme[define-struct], @scheme[make-struct-type], or - @scheme[make-struct-field-accessor], @scheme[#f] otherwise.} + @racket[#t] if @racket[v] is an accessor procedure generated by + @racket[struct], @racket[make-struct-type], or + @racket[make-struct-field-accessor], @racket[#f] otherwise.} @defproc[(struct-mutator-procedure? [v any/c]) boolean?]{Returns - @scheme[#t] if @scheme[v] is a mutator procedure generated by - @scheme[define-struct], @scheme[make-struct-type], or - @scheme[make-struct-field-mutator], @scheme[#f] otherwise.} + @racket[#t] if @racket[v] is a mutator procedure generated by + @racket[struct], @racket[make-struct-type], or + @racket[make-struct-field-mutator], @racket[#f] otherwise.} @defproc[(prefab-struct-key [v any/c]) (or/c #f symbol? list?)]{ -Returns @scheme[#f] if @scheme[v] is not an instance of a +Returns @racket[#f] if @racket[v] is not an instance of a @tech{prefab} structure type. Otherwise, the result is the shorted key -that could be used with @scheme[make-prefab-struct] to create an instance +that could be used with @racket[make-prefab-struct] to create an instance of the structure type. @examples[ (prefab-struct-key #s(cat "Garfield")) -(define-struct cat (name) #:prefab) -(define-struct (cute-cat cat) (shipping-dest) #:prefab) -(make-cute-cat "Nermel" "Abu Dhabi") -(prefab-struct-key (make-cute-cat "Nermel" "Abu Dhabi")) +(struct cat (name) #:prefab) +(struct cute-cat cat (shipping-dest) #:prefab) +(cute-cat "Nermel" "Abu Dhabi") +(prefab-struct-key (cute-cat "Nermel" "Abu Dhabi")) ]} @defproc[(make-prefab-struct [key (or/c symbol? list?)] [v any/c] ...) struct?]{ Creates an instance of a @tech{prefab} structure type, using the -@scheme[v]s as field values. The @scheme[key] and the number of -@scheme[v]s determine the @tech{prefab} structure type. +@racket[v]s as field values. The @racket[key] and the number of +@racket[v]s determine the @tech{prefab} structure type. -A @scheme[key] identifies a structure type based on a list with the +A @racket[key] identifies a structure type based on a list with the following items: @itemize[ @@ -502,7 +502,7 @@ following items: @item{A vector of exact, nonnegative integers that indicate mutable non-automatic fields in the structure type, counting from - @scheme[0] and not including fields from the supertype (if + @racket[0] and not including fields from the supertype (if any).} @item{Nothing else, if the structure type has no @@ -511,17 +511,17 @@ following items: ] -An empty vector and an auto-field list that starts with @scheme[0] can +An empty vector and an auto-field list that starts with @racket[0] can be omitted. Furthermore, the first integer (which indicates the number of non-automatic fields) can be omitted, since it can be inferred from -the number of supplied @scheme[v]s. Finally, a single symbol can be +the number of supplied @racket[v]s. Finally, a single symbol can be used instead of a list that contains only a symbol (in the case that the structure type has no supertype, no automatic fields, and no mutable fields). The total field count must be no more than 32768. If the number of -fields indicated by @scheme[key] is inconsistent with the number of -supplied @scheme[v]s, the @exnraise[exn:fail:contract]. +fields indicated by @racket[key] is inconsistent with the number of +supplied @racket[v]s, the @exnraise[exn:fail:contract]. @examples[ (make-prefab-struct 'clown "Binky" "pie") @@ -536,29 +536,29 @@ supplied @scheme[v]s, the @exnraise[exn:fail:contract]. struct-type?]{ Returns a @tech{structure type descriptor} for the @tech{prefab} -structure type specified by the combination of @scheme[key] and -@scheme[field-count].} +structure type specified by the combination of @racket[key] and +@racket[field-count].} @;------------------------------------------------------------------------ @section[#:tag "structinfo"]{Structure Type Transformer Binding} -The @scheme[define-struct] form binds the name of a structure type as +The @racket[struct] form binds the name of a structure type as a @tech{transformer binding} that records the other identifiers bound to the structure type, the constructor procedure, the predicate procedure, and the field accessor and mutator procedures. This information can be used during the expansion of other expressions via -@scheme[syntax-local-value]. +@racket[syntax-local-value]. -For example, the @scheme[define-struct] variant for subtypes uses the -base type name @scheme[_t] to find the variable -@schemeidfont{struct:}@scheme[_t] containing the base type's descriptor; it +For example, the @racket[struct] variant for subtypes uses the +base type name @racket[_t] to find the variable +@racketidfont{struct:}@racket[_t] containing the base type's descriptor; it also folds the field accessor and mutator information for the base type into the information for the subtype. As another example, the -@scheme[match] form uses a type name to find the predicates and field -accessors for the structure type. The @scheme[struct] form in an -imported signature for @scheme[unit] causes the @scheme[unit] +@racket[match] form uses a type name to find the predicates and field +accessors for the structure type. The @racket[struct] form in an +imported signature for @racket[unit] causes the @racket[unit] transformer to generate information about imported structure types, so -that @scheme[match] and subtyping @scheme[define-struct] forms work +that @racket[match] and subtyping @racket[struct] forms work within the unit. The expansion-time information for a structure type can be represented @@ -568,17 +568,17 @@ encapsulated procedure must return): @itemize[ @item{an identifier that is bound to the structure type's descriptor, - or @scheme[#f] it none is known;} + or @racket[#f] it none is known;} @item{an identifier that is bound to the structure type's constructor, - or @scheme[#f] it none is known;} + or @racket[#f] it none is known;} @item{an identifier that is bound to the structure type's predicate, - or @scheme[#f] it none is known;} + or @racket[#f] it none is known;} @item{a list of identifiers bound to the field accessors of the - structure type, optionally with @scheme[#f] as the list's last - element. A @scheme[#f] as the last element indicates that the + structure type, optionally with @racket[#f] as the list's last + element. A @racket[#f] as the last element indicates that the structure type may have additional fields, otherwise the list is a reliable indicator of the number of fields in the structure type. Furthermore, the accessors are listed in reverse order for the @@ -586,44 +586,44 @@ encapsulated procedure must return): sharing in the lists for a subtype and its base type.)} @item{a list of identifiers bound to the field mutators of - the structure type, or @scheme[#f] for each field that has no known - mutator, and optionally with an extra @scheme[#f] as the list's last - element (if the accessor list has such a @scheme[#f]). The list's - order and the meaning of a final @scheme[#f] are the same as for the + the structure type, or @racket[#f] for each field that has no known + mutator, and optionally with an extra @racket[#f] as the list's last + element (if the accessor list has such a @racket[#f]). The list's + order and the meaning of a final @racket[#f] are the same as for the accessor identifiers, and the length of the mutator list is the same as the accessor list's length.} @item{an identifier that determines a super-type for the structure - type, @scheme[#f] if the super-type (if any) is unknown, or - @scheme[#t] if there is no super-type. If a super-type is specified, + type, @racket[#f] if the super-type (if any) is unknown, or + @racket[#t] if there is no super-type. If a super-type is specified, the identifier is also bound to structure-type expansion-time information.} ] Instead of this direct representation, the representation can be a -structure created by @scheme[make-struct-info] (or an instance of a -subtype of @scheme[struct:struct-info]), which encapsulates a +structure created by @racket[make-struct-info] (or an instance of a +subtype of @racket[struct:struct-info]), which encapsulates a procedure that takes no arguments and returns a list of six elements. Alternately, the representation can be a structure whose -type has the @scheme[prop:struct-info] @tech{structure type property}. +type has the @racket[prop:struct-info] @tech{structure type property}. Finally, the representation can be an instance of a structure type -derived from @scheme[struct:struct-info] or with the -@scheme[prop:struct-info] property that also implements -@scheme[prop:procedure], and where the instance is further is wrapped -by @scheme[make-set!-transformer]. +derived from @racket[struct:struct-info] or with the +@racket[prop:struct-info] property that also implements +@racket[prop:procedure], and where the instance is further is wrapped +by @racket[make-set!-transformer]. -Use @scheme[struct-info?] to recognize all allowed forms of the -information, and use @scheme[extract-struct-info] to obtain a list +Use @racket[struct-info?] to recognize all allowed forms of the +information, and use @racket[extract-struct-info] to obtain a list from any representation. The implementor of a syntactic form can expect users of the form to know what kind of information is available about a structure type. For -example, the @scheme[match] implementation works with structure +example, the @racket[match] implementation works with structure information containing an incomplete set of accessor bindings, because the user is assumed to know what information is available in the -context of the @scheme[match] expression. In particular, the -@scheme[match] expression can appear in a @scheme[unit] form with an +context of the @racket[match] expression. In particular, the +@racket[match] expression can appear in a @racket[unit] form with an imported structure type, in which case the user is expected to know the set of fields that are listed in the signature for the structure type. @@ -632,17 +632,17 @@ type. @defproc[(struct-info? [v any/c]) boolean?]{ -Returns @scheme[#t] if @scheme[v] is either a six-element list with +Returns @racket[#t] if @racket[v] is either a six-element list with the correct shape for representing structure-type information, a -procedure encapsulated by @scheme[make-struct-info], a structure with -the @scheme[prop:struct-info] property, or a structure type derived -from @scheme[struct:struct-info] or with @scheme[prop:struct-info] and -wrapped with @scheme[make-set!-transformer].} +procedure encapsulated by @racket[make-struct-info], a structure with +the @racket[prop:struct-info] property, or a structure type derived +from @racket[struct:struct-info] or with @racket[prop:struct-info] and +wrapped with @racket[make-set!-transformer].} @defproc[(checked-struct-info? [v any/c]) boolean?]{ -Returns @scheme[#t] if @scheme[v] is a procedure encapsulated by -@scheme[make-struct-info] and produced by @scheme[define-struct], but +Returns @racket[#t] if @racket[v] is a procedure encapsulated by +@racket[make-struct-info] and produced by @racket[struct], but only when no parent type is specified or the parent type is also specified through a transformer binding to such a value.} @@ -656,20 +656,20 @@ form.} (and/c struct-info? list?)]{ Extracts the list form of the structure type information represented -by @scheme[v].} +by @racket[v].} @defthing[struct:struct-info struct-type?]{ The @tech{structure type descriptor} for the structure type returned -by @scheme[make-struct-info]. This @tech{structure type descriptor} is +by @racket[make-struct-info]. This @tech{structure type descriptor} is mostly useful for creating structure subtypes. The structure type includes a guard that checks an instance's first field in the same way -as @scheme[make-struct-info].} +as @racket[make-struct-info].} @defthing[prop:struct-info struct-type-property?]{ The @tech{structure type property} for creating new structure types -like @scheme[struct:struct-info]. The property value must a procedure +like @racket[struct:struct-info]. The property value must a procedure of one argument that takes an instance structure and returns structure-type information in list form.} From 22470e414713ab34f653fb96f062338abfb3d334 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sat, 24 Apr 2010 07:17:53 -0600 Subject: [PATCH 25/43] racket-tool -> raco --- collects/compiler/commands/c-ext.ss | 2 +- collects/compiler/commands/decompile.ss | 2 +- collects/compiler/commands/exe-dir.ss | 2 +- collects/compiler/commands/exe.ss | 2 +- collects/compiler/commands/expand.ss | 2 +- collects/compiler/commands/info.ss | 2 +- collects/compiler/commands/make.ss | 2 +- collects/compiler/commands/pack.ss | 2 +- collects/help/help.ss | 4 +++- collects/help/info.ss | 2 +- collects/help/installer.ss | 2 +- collects/meta/dist-specs.ss | 4 ++-- collects/planet/info.ss | 2 +- collects/planet/planet.ss | 2 +- collects/{tool => raco}/all-tools.ss | 6 +++--- collects/{tool => raco}/command-name.ss | 0 collects/{tool => raco}/info.ss | 2 +- collects/{tool => raco}/main.lch | 0 collects/{tool => raco}/main.ss | 4 ++-- collects/{tool/tool.ss => raco/raco.ss} | 6 +++--- collects/scribble/info.ss | 2 +- collects/scribble/run.ss | 2 +- collects/setup/info.ss | 2 +- collects/setup/setup-cmdline.ss | 6 +++--- src/Makefile.in | 2 +- 25 files changed, 33 insertions(+), 31 deletions(-) rename collects/{tool => raco}/all-tools.ss (85%) rename collects/{tool => raco}/command-name.ss (100%) rename collects/{tool => raco}/info.ss (69%) rename collects/{tool => raco}/main.lch (100%) rename collects/{tool => raco}/main.ss (85%) rename collects/{tool/tool.ss => raco/raco.ss} (92%) diff --git a/collects/compiler/commands/c-ext.ss b/collects/compiler/commands/c-ext.ss index 44456ab4f9..22bc5db193 100644 --- a/collects/compiler/commands/c-ext.ss +++ b/collects/compiler/commands/c-ext.ss @@ -7,7 +7,7 @@ (require (prefix-in compiler:option: "../option.ss") "../compiler.ss" - tool/command-name + raco/command-name mzlib/cmdline dynext/file dynext/compile diff --git a/collects/compiler/commands/decompile.ss b/collects/compiler/commands/decompile.ss index 8b16b48434..0bc201d044 100644 --- a/collects/compiler/commands/decompile.ss +++ b/collects/compiler/commands/decompile.ss @@ -1,6 +1,6 @@ #lang scheme/base (require scheme/cmdline - tool/command-name + raco/command-name compiler/zo-parse compiler/decompile scheme/pretty) diff --git a/collects/compiler/commands/exe-dir.ss b/collects/compiler/commands/exe-dir.ss index 95f28d1aee..dae09d1438 100644 --- a/collects/compiler/commands/exe-dir.ss +++ b/collects/compiler/commands/exe-dir.ss @@ -1,6 +1,6 @@ #lang scheme/base (require scheme/cmdline - tool/command-name + raco/command-name compiler/distribute) (define verbose (make-parameter #f)) diff --git a/collects/compiler/commands/exe.ss b/collects/compiler/commands/exe.ss index 762df0ff2b..59a956f60f 100644 --- a/collects/compiler/commands/exe.ss +++ b/collects/compiler/commands/exe.ss @@ -1,6 +1,6 @@ #lang scheme/base (require scheme/cmdline - tool/command-name + raco/command-name compiler/private/embed dynext/file) diff --git a/collects/compiler/commands/expand.ss b/collects/compiler/commands/expand.ss index ed742087c1..181b79b1c3 100644 --- a/collects/compiler/commands/expand.ss +++ b/collects/compiler/commands/expand.ss @@ -1,6 +1,6 @@ #lang scheme/base (require scheme/cmdline - tool/command-name + raco/command-name scheme/pretty) (define source-files diff --git a/collects/compiler/commands/info.ss b/collects/compiler/commands/info.ss index a2fef6dcbd..732470021c 100644 --- a/collects/compiler/commands/info.ss +++ b/collects/compiler/commands/info.ss @@ -1,6 +1,6 @@ #lang setup/infotab -(define racket-tools +(define raco-commands '(("make" compiler/commands/make "compile source to bytecode" 100) ("exe" compiler/commands/exe "create executable" 20) ("pack" compiler/commands/pack "pack files/collections into a .plt archive" 10) diff --git a/collects/compiler/commands/make.ss b/collects/compiler/commands/make.ss index 61336ce1e4..20b8ea9c5f 100644 --- a/collects/compiler/commands/make.ss +++ b/collects/compiler/commands/make.ss @@ -1,6 +1,6 @@ #lang scheme/base (require scheme/cmdline - tool/command-name + raco/command-name compiler/cm "../compiler.ss" dynext/file) diff --git a/collects/compiler/commands/pack.ss b/collects/compiler/commands/pack.ss index add2f667b1..852ee99d74 100644 --- a/collects/compiler/commands/pack.ss +++ b/collects/compiler/commands/pack.ss @@ -1,6 +1,6 @@ #lang scheme/base (require scheme/cmdline - tool/command-name + raco/command-name setup/pack setup/getinfo compiler/distribute) diff --git a/collects/help/help.ss b/collects/help/help.ss index 340a7a7c20..039a343837 100644 --- a/collects/help/help.ss +++ b/collects/help/help.ss @@ -1,10 +1,12 @@ #lang scheme/base -(require "search.ss" scheme/cmdline scheme/list scheme/string) +(require "search.ss" scheme/cmdline scheme/list scheme/string + raco/command-name) ;; Minimal command-line arguments, the query string can contain all ;; kinds of magic. (command-line + #:program (short-program+command-name) #:handlers (lambda (_ . ts) (if (null? ts) diff --git a/collects/help/info.ss b/collects/help/info.ss index 8d3e9814ac..d2f4cd6ae0 100644 --- a/collects/help/info.ss +++ b/collects/help/info.ss @@ -1,4 +1,4 @@ #lang setup/infotab (define post-install-collection "installer.ss") -(define racket-tools '(("docs" help/help "search and view documentation" 100))) +(define raco-commands '(("docs" help/help "search and view documentation" 100))) diff --git a/collects/help/installer.ss b/collects/help/installer.ss index cd1f5959ed..9507d8646a 100644 --- a/collects/help/installer.ss +++ b/collects/help/installer.ss @@ -27,7 +27,7 @@ (parameterize ([current-launcher-variant variant]) (mk-launcher '("-l-" "help/help") (mk-path "plt-help") ;; change to "Racket Docs" - `([exe-name . "plt-help"] ;; get rid of this (in favor of 'racket-tool docs') + `([exe-name . "plt-help"] ;; get rid of this (in favor of 'raco docs') [relative? . #t] [framework-root . #f] [dll-dir . #f] diff --git a/collects/meta/dist-specs.ss b/collects/meta/dist-specs.ss index d1079e3539..6dd42893ab 100644 --- a/collects/meta/dist-specs.ss +++ b/collects/meta/dist-specs.ss @@ -431,8 +431,8 @@ platform-dependent := ; hook for package rules mz-extras :+= (- (package: "setup-plt" #:collection "setup/") (cond (not dr) => (srcfile: "plt-installer{|-sig|-unit}.ss"))) -;; -------------------- racket-tool -mz-extras :+= (package: "tool") +;; -------------------- raco +mz-extras :+= (package: "raco") ;; -------------------- launcher mz-extras :+= (- (collects: "launcher") diff --git a/collects/planet/info.ss b/collects/planet/info.ss index b39b69aa6a..b27175645e 100644 --- a/collects/planet/info.ss +++ b/collects/planet/info.ss @@ -5,4 +5,4 @@ (define mzscheme-launcher-libraries '("planet.ss")) (define scribblings '(("planet.scrbl" (multi-page) (tool)))) -(define racket-tools '(("planet" planet/planet "manage Planet package installations" 80))) +(define raco-commands '(("planet" planet/planet "manage Planet package installations" 80))) diff --git a/collects/planet/planet.ss b/collects/planet/planet.ss index c1b84adfe6..2536551d89 100644 --- a/collects/planet/planet.ss +++ b/collects/planet/planet.ss @@ -11,7 +11,7 @@ PLANNED FEATURES: (only mzlib/list sort) net/url mzlib/match - tool/command-name + raco/command-name "config.ss" "private/planet-shared.ss" diff --git a/collects/tool/all-tools.ss b/collects/raco/all-tools.ss similarity index 85% rename from collects/tool/all-tools.ss rename to collects/raco/all-tools.ss index d47ac7632e..b877f3ee71 100644 --- a/collects/tool/all-tools.ss +++ b/collects/raco/all-tools.ss @@ -4,11 +4,11 @@ (provide all-tools) (define (all-tools) - (let* ([dirs (find-relevant-directories '(racket-tools))] + (let* ([dirs (find-relevant-directories '(raco-commands))] [tools (make-hash)]) (for ([i (in-list (map get-info/full dirs))] [d (in-list dirs)]) - (let ([entries (let ([l (i 'racket-tools (lambda () null))]) + (let ([entries (let ([l (i 'raco-commands (lambda () null))]) (if (list? l) l (list l)))]) @@ -33,7 +33,7 @@ [else (fprintf (current-error-port) - "warning: ~s provided bad `racket-tools' spec: ~e" + "warning: ~s provided bad `raco-commands' spec: ~e" d entry)])))) tools)) diff --git a/collects/tool/command-name.ss b/collects/raco/command-name.ss similarity index 100% rename from collects/tool/command-name.ss rename to collects/raco/command-name.ss diff --git a/collects/tool/info.ss b/collects/raco/info.ss similarity index 69% rename from collects/tool/info.ss rename to collects/raco/info.ss index d3177af88f..62887e73b9 100644 --- a/collects/tool/info.ss +++ b/collects/raco/info.ss @@ -3,4 +3,4 @@ (define compile-omit-paths '("main.ss")) (define racket-launcher-libraries '("main.ss")) -(define racket-launcher-names '("racket-tool")) +(define racket-launcher-names '("raco")) diff --git a/collects/tool/main.lch b/collects/raco/main.lch similarity index 100% rename from collects/tool/main.lch rename to collects/raco/main.lch diff --git a/collects/tool/main.ss b/collects/raco/main.ss similarity index 85% rename from collects/tool/main.ss rename to collects/raco/main.ss index 6a95d0e59c..335ed7c379 100644 --- a/collects/tool/main.ss +++ b/collects/raco/main.ss @@ -1,5 +1,5 @@ -;; Because `racket-tool setup' is used to rebuild .zos, check for "setup" +;; Because `raco setup' is used to rebuild .zos, check for "setup" ;; directly. ;; Note that this file is listed in "info.ss" so that it never gets a @@ -19,4 +19,4 @@ (cdr (vector->list cmdline)))]) (dynamic-require 'setup/main #f)) - (dynamic-require 'tool/tool #f)))) + (dynamic-require 'raco/raco #f)))) diff --git a/collects/tool/tool.ss b/collects/raco/raco.ss similarity index 92% rename from collects/tool/tool.ss rename to collects/raco/raco.ss index dca3d2c8d6..9d29d1dcb8 100644 --- a/collects/tool/tool.ss +++ b/collects/raco/raco.ss @@ -54,7 +54,7 @@ (find-system-path 'run-file) (car cmdline)) #f])]) - (fprintf (current-error-port) "Usage: racket-tool