fix make-base-namespace in scheme/base (PR 10870)
This commit is contained in:
parent
4fe5353dc3
commit
a6694a08b7
|
@ -1,11 +1,11 @@
|
||||||
#lang scheme/base
|
#lang racket/base
|
||||||
|
|
||||||
(require scheme/port
|
(require racket/port
|
||||||
scheme/path
|
racket/path
|
||||||
scheme/list
|
racket/list
|
||||||
scheme/string
|
racket/string
|
||||||
syntax/moddep
|
syntax/moddep
|
||||||
scheme/gui/dynamic
|
racket/gui/dynamic
|
||||||
planet/config)
|
planet/config)
|
||||||
|
|
||||||
(provide gui?
|
(provide gui?
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
|
|
||||||
(define gui? (gui-available?))
|
(define gui? (gui-available?))
|
||||||
|
|
||||||
(define-syntax mz/mr ; use a value for mzscheme, or pull a mred binding
|
(define-syntax mz/mr ; use a value for mzracket, or pull a mred binding
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
[(mz/mr mzval mrsym)
|
[(mz/mr mzval mrsym)
|
||||||
(if gui? (gui-dynamic-require 'mrsym) mzval)]))
|
(if gui? (gui-dynamic-require 'mrsym) mzval)]))
|
||||||
|
@ -479,8 +479,8 @@
|
||||||
;; needed to make the test-engine work
|
;; needed to make the test-engine work
|
||||||
(let ([orig-ns (namespace-anchor->empty-namespace anchor)])
|
(let ([orig-ns (namespace-anchor->empty-namespace anchor)])
|
||||||
(parameterize ([current-namespace orig-ns])
|
(parameterize ([current-namespace orig-ns])
|
||||||
(dynamic-require 'scheme/class #f))
|
(dynamic-require 'racket/class #f))
|
||||||
(namespace-attach-module orig-ns 'scheme/class))]))
|
(namespace-attach-module orig-ns 'racket/class))]))
|
||||||
|
|
||||||
;; Returns a single (module ...) or (begin ...) expression (a `begin' list
|
;; Returns a single (module ...) or (begin ...) expression (a `begin' list
|
||||||
;; will be evaluated one by one -- the language might not have a `begin').
|
;; will be evaluated one by one -- the language might not have a `begin').
|
||||||
|
@ -490,7 +490,7 @@
|
||||||
;; A more general solution would be to create a new module that exports
|
;; A more general solution would be to create a new module that exports
|
||||||
;; the given language plus all of the given extra requires.
|
;; the given language plus all of the given extra requires.
|
||||||
;;
|
;;
|
||||||
;; We use `#%requre' because, unlike the `require' of scheme/base,
|
;; We use `#%requre' because, unlike the `require' of racket/base,
|
||||||
;; it comes from `#%kernel', so it's always present through
|
;; it comes from `#%kernel', so it's always present through
|
||||||
;; transitive requires.
|
;; transitive requires.
|
||||||
(define (build-program language requires input-program)
|
(define (build-program language requires input-program)
|
||||||
|
@ -882,7 +882,7 @@
|
||||||
(if (eq? h default-sandbox-exit-handler)
|
(if (eq? h default-sandbox-exit-handler)
|
||||||
(lambda _ (terminate+kill! 'exited #f))
|
(lambda _ (terminate+kill! 'exited #f))
|
||||||
h))]
|
h))]
|
||||||
;; Note the above definition of `current-eventspace': in MzScheme, it
|
;; Note the above definition of `current-eventspace': in Racket, it
|
||||||
;; is an unused parameter. Also note that creating an eventspace
|
;; is an unused parameter. Also note that creating an eventspace
|
||||||
;; starts a thread that will eventually run the callback code (which
|
;; starts a thread that will eventually run the callback code (which
|
||||||
;; evaluates the program in `run-in-bg') -- so this parameterization
|
;; evaluates the program in `run-in-bg') -- so this parameterization
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#lang scheme/private
|
#lang scheme/private
|
||||||
|
(require "private/namespace.ss")
|
||||||
|
|
||||||
(provide (except-out (all-from-out racket/base)
|
(provide (except-out (all-from-out racket/base)
|
||||||
struct
|
struct
|
||||||
hash hasheq hasheqv))
|
hash hasheq hasheqv)
|
||||||
|
make-base-empty-namespace
|
||||||
|
make-base-namespace)
|
||||||
|
|
21
collects/scheme/private/namespace.ss
Normal file
21
collects/scheme/private/namespace.ss
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#lang racket/base
|
||||||
|
|
||||||
|
(provide make-base-empty-namespace
|
||||||
|
make-base-namespace)
|
||||||
|
|
||||||
|
(define orig-varref (#%variable-reference orig-varref))
|
||||||
|
|
||||||
|
(define (make-base-empty-namespace)
|
||||||
|
(let* ([this-ns (variable-reference->empty-namespace orig-varref)]
|
||||||
|
[ns (parameterize ([current-namespace this-ns]) ; ensures correct phase
|
||||||
|
(make-empty-namespace))])
|
||||||
|
(namespace-attach-module this-ns
|
||||||
|
'scheme/base
|
||||||
|
ns)
|
||||||
|
ns))
|
||||||
|
|
||||||
|
(define (make-base-namespace)
|
||||||
|
(let ([ns (make-base-empty-namespace)])
|
||||||
|
(parameterize ([current-namespace ns])
|
||||||
|
(namespace-require 'scheme/base))
|
||||||
|
ns))
|
|
@ -1,2 +1,36 @@
|
||||||
#lang scheme/private/provider
|
#lang scheme/base
|
||||||
racket/sandbox
|
(require racket/sandbox
|
||||||
|
scheme/gui/dynamic)
|
||||||
|
|
||||||
|
(provide (except-out (all-from-out racket/sandbox)
|
||||||
|
sandbox-namespace-specs
|
||||||
|
make-evaluator
|
||||||
|
make-module-evaluator)
|
||||||
|
(rename-out
|
||||||
|
[scheme:sandbox-namespace-specs sandbox-namespace-specs]
|
||||||
|
[scheme:make-evaluator make-evaluator]
|
||||||
|
[scheme:make-module-evaluator make-module-evaluator]))
|
||||||
|
|
||||||
|
;; copied from racket/sandbox :(
|
||||||
|
(define-syntax mz/mr ; use a value for mzracket, or pull a mred binding
|
||||||
|
(syntax-rules ()
|
||||||
|
[(mz/mr mzval mrsym)
|
||||||
|
(if gui? (gui-dynamic-require 'mrsym) mzval)]))
|
||||||
|
|
||||||
|
|
||||||
|
(define scheme:sandbox-namespace-specs
|
||||||
|
(make-parameter `(,(mz/mr make-base-namespace make-gui-namespace))))
|
||||||
|
|
||||||
|
(define (scheme:make-evaluator language
|
||||||
|
#:requires [requires null] #:allow-read [allow null]
|
||||||
|
. input-program)
|
||||||
|
(parameterize ([sandbox-namespace-specs (scheme:sandbox-namespace-specs)])
|
||||||
|
(apply make-evaluator
|
||||||
|
language #:requires requires #:allow-read allow
|
||||||
|
input-program)))
|
||||||
|
|
||||||
|
(define (scheme:make-module-evaluator
|
||||||
|
input-program #:allow-read [allow null] #:language [reqlang #f])
|
||||||
|
(parameterize ([sandbox-namespace-specs (scheme:sandbox-namespace-specs)])
|
||||||
|
(make-module-evaluator
|
||||||
|
input-program #:allow-read allow #:language reqlang)))
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"scheme.ss"
|
"scheme.ss"
|
||||||
"decode.ss"
|
"decode.ss"
|
||||||
racket/file
|
racket/file
|
||||||
scheme/sandbox
|
racket/sandbox
|
||||||
racket/promise
|
racket/promise
|
||||||
mzlib/string
|
mzlib/string
|
||||||
(for-syntax racket/base))
|
(for-syntax racket/base))
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#lang scheme/base
|
#lang racket/base
|
||||||
|
|
||||||
(require scheme/promise "text/output.ss" "text/syntax-utils.ss")
|
(require racket/promise "text/output.ss" "text/syntax-utils.ss")
|
||||||
(provide (all-from-out scheme/promise "text/output.ss")
|
(provide (all-from-out racket/promise "text/output.ss")
|
||||||
begin/text include/text)
|
begin/text include/text)
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#lang scheme/base
|
#lang racket/base
|
||||||
|
|
||||||
(require "syntax-utils.ss" "output.ss" scheme/promise)
|
(require "syntax-utils.ss" "output.ss" racket/promise)
|
||||||
|
|
||||||
(provide (except-out (all-from-out scheme/base) #%module-begin)
|
(provide (except-out (all-from-out racket/base) #%module-begin)
|
||||||
(all-from-out "output.ss" scheme/promise)
|
(all-from-out "output.ss" racket/promise)
|
||||||
begin/text
|
begin/text
|
||||||
(rename-out [module-begin/text #%module-begin]
|
(rename-out [module-begin/text #%module-begin]
|
||||||
[include/text include]))
|
[include/text include]))
|
||||||
|
|
|
@ -1,12 +1,21 @@
|
||||||
#lang scribble/manual
|
#lang scribble/manual
|
||||||
@(require (for-syntax racket)
|
@(require (for-syntax racket)
|
||||||
(for-label (only-in scheme/foreign unsafe! provide* define-unsafer)))
|
(for-label (only-in scheme/foreign unsafe! provide* define-unsafer)
|
||||||
|
(only-in racket/base make-base-namespace make-base-empty-namespace)))
|
||||||
|
|
||||||
@(define-syntax-rule (def-extras unit-struct)
|
@(define-syntax-rule (def-extras unit-struct
|
||||||
|
make-base-namespace-id
|
||||||
|
make-base-empty-namespace-id)
|
||||||
(begin
|
(begin
|
||||||
(require (for-label scheme))
|
(require (for-label (only-in scheme struct)
|
||||||
(define unit-struct (racket struct))))
|
(only-in racket/base make-base-namespace
|
||||||
@(def-extras unit-struct)
|
make-base-empty-namespace)))
|
||||||
|
(define unit-struct (racket struct))
|
||||||
|
(define make-base-namespace-id (racket make-base-namespace))
|
||||||
|
(define make-base-empty-namespace-id (racket make-base-empty-namespace))))
|
||||||
|
@(def-extras unit-struct
|
||||||
|
make-base-namespace-id
|
||||||
|
make-base-empty-namespace-id)
|
||||||
|
|
||||||
@(define-syntax-rule (compat-except sid rid . rest)
|
@(define-syntax-rule (compat-except sid rid . rest)
|
||||||
(begin
|
(begin
|
||||||
|
@ -29,7 +38,20 @@ old name.
|
||||||
@schememodname[scheme/unit] is exported, instead}
|
@schememodname[scheme/unit] is exported, instead}
|
||||||
|
|
||||||
@compat-except[scheme/base racket/base]{, except that
|
@compat-except[scheme/base racket/base]{, except that
|
||||||
@schememodname[racket]'s @scheme[struct] is not exported}
|
@schememodname[racket]'s @scheme[struct] is not exported, and
|
||||||
|
@scheme[make-base-namespace] and @scheme[make-base-empty-namespace]
|
||||||
|
are different}
|
||||||
|
|
||||||
|
@defproc[(make-base-empty-namespace) namespace?]{
|
||||||
|
|
||||||
|
Like @|make-base-empty-namespace-id| from @schememodname[racket/base],
|
||||||
|
but with @schememodname[scheme/base] attached.}
|
||||||
|
|
||||||
|
@defproc[(make-base-namespace) namespace?]{
|
||||||
|
|
||||||
|
Like @|make-base-namespace-id| from @schememodname[racket/base], but
|
||||||
|
with @schememodname[scheme/base] attached.}
|
||||||
|
|
||||||
|
|
||||||
@compat[scheme/async-channel racket/async-channel]
|
@compat[scheme/async-channel racket/async-channel]
|
||||||
@compat[scheme/bool racket/bool]
|
@compat[scheme/bool racket/bool]
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
scribble/html-properties
|
scribble/html-properties
|
||||||
scribble/latex-properties
|
scribble/latex-properties
|
||||||
"utils.ss"
|
"utils.ss"
|
||||||
(for-label scheme/base))
|
(for-label racket/base))
|
||||||
|
|
||||||
@(define (fake-title . str) (apply bold str))
|
@(define (fake-title . str) (apply bold str))
|
||||||
|
|
||||||
|
@ -20,16 +20,16 @@ extend or configure Scribble fall into two groups:
|
||||||
@item{You may need to drop into the back-end ``language'' of CSS or
|
@item{You may need to drop into the back-end ``language'' of CSS or
|
||||||
Latex to create a specific output effect. For this kind of
|
Latex to create a specific output effect. For this kind of
|
||||||
extension, you will mostly likely attach a
|
extension, you will mostly likely attach a
|
||||||
@scheme[css-addition] or @scheme[tex-addition] @tech{style property}
|
@racket[css-addition] or @racket[tex-addition] @tech{style property}
|
||||||
to style, where the addition implements the style name. This
|
to style, where the addition implements the style name. This
|
||||||
kind of extension is described in @secref["extra-style"].}
|
kind of extension is described in @secref["extra-style"].}
|
||||||
|
|
||||||
@item{You may need to produce a document whose page layout is
|
@item{You may need to produce a document whose page layout is
|
||||||
different from the PLT Scheme documentation style. For that
|
different from the Racket documentation style. For that
|
||||||
kind of configuration, you can run the @exec{scribble} command-line
|
kind of configuration, you can run the @exec{scribble} command-line
|
||||||
tool and supply flags like @DFlag{prefix} or @DPFlag{style}, or
|
tool and supply flags like @DFlag{prefix} or @DPFlag{style}, or
|
||||||
you can associate a @scheme[html-defaults] or
|
you can associate a @racket[html-defaults] or
|
||||||
@scheme[latex-defaults] @tech{style property} to the main document's
|
@racket[latex-defaults] @tech{style property} to the main document's
|
||||||
style. This kind of configuration is described in
|
style. This kind of configuration is described in
|
||||||
@secref["config-style"].}
|
@secref["config-style"].}
|
||||||
|
|
||||||
|
@ -42,46 +42,46 @@ extend or configure Scribble fall into two groups:
|
||||||
(make-tex-addition "inbox.tex")))
|
(make-tex-addition "inbox.tex")))
|
||||||
]{Implementing Styles}
|
]{Implementing Styles}
|
||||||
|
|
||||||
When a string is uses as a style in an @scheme[element],
|
When a string is uses as a style in an @racket[element],
|
||||||
a @scheme[multiarg-element], @scheme[paragraph], @scheme[table],
|
a @racket[multiarg-element], @racket[paragraph], @racket[table],
|
||||||
@scheme[itemization], @scheme[nested-flow], or
|
@racket[itemization], @racket[nested-flow], or
|
||||||
@scheme[compound-paragraph], it corresponds to a CSS class for HTML
|
@racket[compound-paragraph], it corresponds to a CSS class for HTML
|
||||||
output or a Latex macro/environment for Latex output. In Latex output,
|
output or a Latex macro/environment for Latex output. In Latex output,
|
||||||
the string is used as a command name for a @scheme[paragraph]
|
the string is used as a command name for a @racket[paragraph]
|
||||||
and an environment name for a @scheme[table], @scheme[itemization],
|
and an environment name for a @racket[table], @racket[itemization],
|
||||||
@scheme[nested-flow], or @scheme[compound-paragraph]; the if style has
|
@racket[nested-flow], or @racket[compound-paragraph]; the if style has
|
||||||
a @scheme['command] @tech{style property} for a @scheme[nested-flow] or
|
a @racket['command] @tech{style property} for a @racket[nested-flow] or
|
||||||
@scheme[compound-paragraph], then the style name is used as a command
|
@racket[compound-paragraph], then the style name is used as a command
|
||||||
instead of an environment. In addition, for an itemization, the style
|
instead of an environment. In addition, for an itemization, the style
|
||||||
string is suffixed with @scheme["Item"] and used as a CSS class or Latex
|
string is suffixed with @racket["Item"] and used as a CSS class or Latex
|
||||||
macro name to use for the itemization's items (in place of @tt{item}
|
macro name to use for the itemization's items (in place of @tt{item}
|
||||||
in the case of Latex).
|
in the case of Latex).
|
||||||
|
|
||||||
To add a mapping from your own style name to a CSS configuration, add
|
To add a mapping from your own style name to a CSS configuration, add
|
||||||
a @scheme[css-addition] structure instance to a style's @tech{style property}
|
a @racket[css-addition] structure instance to a style's @tech{style property}
|
||||||
list. To map a style name to a Latex macro or environment, add a
|
list. To map a style name to a Latex macro or environment, add a
|
||||||
@scheme[tex-addition] structure instance. A @scheme[css-addition] or
|
@racket[tex-addition] structure instance. A @racket[css-addition] or
|
||||||
@scheme[tex-addition] is normally associated with the style whose name
|
@racket[tex-addition] is normally associated with the style whose name
|
||||||
is implemented by the adition, but it can also be added to the style
|
is implemented by the adition, but it can also be added to the style
|
||||||
for an enclosing part.
|
for an enclosing part.
|
||||||
|
|
||||||
Scribble includes a number of predefined styles that are used by the
|
Scribble includes a number of predefined styles that are used by the
|
||||||
exports of @scheme[scribble/base]. You can use them or redefine
|
exports of @racket[scribble/base]. You can use them or redefine
|
||||||
them. The styles are specified by @filepath{scribble.css} and
|
them. The styles are specified by @filepath{scribble.css} and
|
||||||
@filepath{scribble.tex} in the @filepath{scribble} collection.
|
@filepath{scribble.tex} in the @filepath{scribble} collection.
|
||||||
|
|
||||||
The styles used by @schememodname[scribble/manual] are implemented by
|
The styles used by @racketmodname[scribble/manual] are implemented by
|
||||||
@filepath{scheme.css} and @filepath{scheme.tex} in the
|
@filepath{racket.css} and @filepath{racket.tex} in the
|
||||||
@filepath{scribble} collection. Other libraries, such as
|
@filepath{scribble} collection. Other libraries, such as
|
||||||
@schememodname[scriblib/autobib], similarly implement styles through files
|
@racketmodname[scriblib/autobib], similarly implement styles through files
|
||||||
that are associated by @scheme[css-addition] and @scheme[tex-addition]
|
that are associated by @racket[css-addition] and @racket[tex-addition]
|
||||||
@tech{style properties}.
|
@tech{style properties}.
|
||||||
|
|
||||||
To avoid collisions with future additions to Scribble, start your
|
To avoid collisions with future additions to Scribble, start your
|
||||||
style name with an uppercase letter that is not @litchar{S}. An
|
style name with an uppercase letter that is not @litchar{S}. An
|
||||||
uppercase letter helps to avoid collisions with macros defined by
|
uppercase letter helps to avoid collisions with macros defined by
|
||||||
Latex packages, and future styles needed by @schememodname[scribble/base] and
|
Latex packages, and future styles needed by @racketmodname[scribble/base] and
|
||||||
@schememodname[scribble/manual] will start with @litchar{S}.
|
@racketmodname[scribble/manual] will start with @litchar{S}.
|
||||||
|
|
||||||
For example, a Scribble document
|
For example, a Scribble document
|
||||||
|
|
||||||
|
@ -136,9 +136,9 @@ set of page-layout and font properties that are used by other
|
||||||
commands. The style-replacement kind of configuration corresponds to
|
commands. The style-replacement kind of configuration corresponds to
|
||||||
re-defining Latex macros or overriding CSS class attributes. When
|
re-defining Latex macros or overriding CSS class attributes. When
|
||||||
@exec{setup-plt} builds PDF documentation, it uses both kinds of
|
@exec{setup-plt} builds PDF documentation, it uses both kinds of
|
||||||
configuration to produce a standard layout for PLT Scheme manuals;
|
configuration to produce a standard layout for Racket manuals;
|
||||||
that is, it selects a particular page layout, and it replaces some
|
that is, it selects a particular page layout, and it replaces some
|
||||||
@schememodname[scheme/base] styles.
|
@racketmodname[racket/base] styles.
|
||||||
|
|
||||||
Two kinds of files implement the two kinds of configuration:
|
Two kinds of files implement the two kinds of configuration:
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ Two kinds of files implement the two kinds of configuration:
|
||||||
|
|
||||||
@item{A @deftech{style file} refines the implementation of styles
|
@item{A @deftech{style file} refines the implementation of styles
|
||||||
nused in the document---typically just the ``built-in'' styles
|
nused in the document---typically just the ``built-in'' styles
|
||||||
used by @schememodname[scribble/base].
|
used by @racketmodname[scribble/base].
|
||||||
|
|
||||||
The default style files, @filepath{scribble-style.css} and
|
The default style files, @filepath{scribble-style.css} and
|
||||||
@filepath{scribble-style.tex} in the @filepath{scribble}
|
@filepath{scribble-style.tex} in the @filepath{scribble}
|
||||||
|
@ -191,24 +191,24 @@ accompanying files:
|
||||||
|
|
||||||
When using the @exec{scribble} command-line utility, a document can
|
When using the @exec{scribble} command-line utility, a document can
|
||||||
declare its default style, prefix, and extra files through a
|
declare its default style, prefix, and extra files through a
|
||||||
@scheme[html-defaults] and/or @scheme[latex-defaults]
|
@racket[html-defaults] and/or @racket[latex-defaults]
|
||||||
@tech{style property}. In particular, when using the @exec{scribble}
|
@tech{style property}. In particular, when using the @exec{scribble}
|
||||||
command-line tool to generate Latex or PDF a document whose main part
|
command-line tool to generate Latex or PDF a document whose main part
|
||||||
is implemented with @scheme[#, @hash-lang[] #,
|
is implemented with @racket[#, @hash-lang[] #,
|
||||||
@schememodname[scribble/manual]], the result has the standard PLT
|
@racketmodname[scribble/manual]], the result has the standard
|
||||||
Scheme manual configuration, because @schememodname[scribble/manual]
|
Racket manual configuration, because @racketmodname[scribble/manual]
|
||||||
associates a @scheme[latex-defaults] @tech{style property} with the exported
|
associates a @racket[latex-defaults] @tech{style property} with the exported
|
||||||
document. The @schememodname[scribble/sigplan] language similarly
|
document. The @racketmodname[scribble/sigplan] language similarly
|
||||||
associates a default configuration with an exported document. As
|
associates a default configuration with an exported document. As
|
||||||
libraries imported with @scheme[require], however,
|
libraries imported with @racket[require], however,
|
||||||
@schememodname[scribble/manual] and @schememodname[scribble/sigplan]
|
@racketmodname[scribble/manual] and @racketmodname[scribble/sigplan]
|
||||||
simply implement new styles in a composable way.
|
simply implement new styles in a composable way.
|
||||||
|
|
||||||
Whether or not a document has a default prefix- and style-file
|
Whether or not a document has a default prefix- and style-file
|
||||||
configuration through a @tech{style property}, the defaults can be
|
configuration through a @tech{style property}, the defaults can be
|
||||||
overridden using @exec{scribble} command-line flags. Furthermore,
|
overridden using @exec{scribble} command-line flags. Furthermore,
|
||||||
languages like @schememodname[scribble/manual] and
|
languages like @racketmodname[scribble/manual] and
|
||||||
@schememodname[scribble/sigplan] add a @scheme[html-defaults] and/or
|
@racketmodname[scribble/sigplan] add a @racket[html-defaults] and/or
|
||||||
@scheme[latex-defaults] @tech{style property} to a main-document part only if
|
@racket[latex-defaults] @tech{style property} to a main-document part only if
|
||||||
it does not already have such a property added through the
|
it does not already have such a property added through the
|
||||||
@scheme[#:style] argument of @scheme[title].
|
@racket[#:style] argument of @racket[title].
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
@(require scribble/manual
|
@(require scribble/manual
|
||||||
scribble/core scribble/html-properties scribble/latex-properties
|
scribble/core scribble/html-properties scribble/latex-properties
|
||||||
"utils.ss"
|
"utils.ss"
|
||||||
(for-label scheme/base
|
(for-label racket/base
|
||||||
;; FIXME: need to get this in
|
;; FIXME: need to get this in
|
||||||
;; scribble/text
|
;; scribble/text
|
||||||
))
|
))
|
||||||
|
@ -13,21 +13,21 @@
|
||||||
(make-css-addition "shaded.css")))
|
(make-css-addition "shaded.css")))
|
||||||
]{Text Preprocessing}
|
]{Text Preprocessing}
|
||||||
|
|
||||||
@defmodulelang[scribble/text]{The @schememodname[scribble/text]
|
@defmodulelang[scribble/text]{The @racketmodname[scribble/text]
|
||||||
language provides everything from @scheme[scheme/base] with a few
|
language provides everything from @racket[racket/base] with a few
|
||||||
changes that make it suitable as a preprocessor language:
|
changes that make it suitable as a preprocessor language:
|
||||||
|
|
||||||
@itemize[
|
@itemize[
|
||||||
|
|
||||||
@item{It uses @scheme[read-syntax-inside] to read the body of the
|
@item{It uses @racket[read-syntax-inside] to read the body of the
|
||||||
module, similar to @secref["docreader"]. This means that by
|
module, similar to @secref["docreader"]. This means that by
|
||||||
default, all text is read in as Scheme strings; and
|
default, all text is read in as Racket strings; and
|
||||||
@seclink["reader"]|{@-forms}| can be used to use Scheme
|
@seclink["reader"]|{@-forms}| can be used to use Racket
|
||||||
functions and expression escapes.}
|
functions and expression escapes.}
|
||||||
|
|
||||||
@item{Values of expressions are printed with a custom
|
@item{Values of expressions are printed with a custom
|
||||||
@scheme[output] function. This function displays most values
|
@racket[output] function. This function displays most values
|
||||||
in a similar way to @scheme[display], except that it is more
|
in a similar way to @racket[display], except that it is more
|
||||||
convenient for a preprocessor output.}]
|
convenient for a preprocessor output.}]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,9 +42,9 @@ changes that make it suitable as a preprocessor language:
|
||||||
@section{Writing Preprocessor Files}
|
@section{Writing Preprocessor Files}
|
||||||
|
|
||||||
The combination of the two features makes text in files in the
|
The combination of the two features makes text in files in the
|
||||||
@scheme[scribble/text] language be read as strings, which get printed
|
@racket[scribble/text] language be read as strings, which get printed
|
||||||
out when the module is @scheme[require]d, for example, when a file is
|
out when the module is @racket[require]d, for example, when a file is
|
||||||
given as an argument to @exec{mzscheme}. (In these example the left
|
given as an argument to @exec{racket}. (In these example the left
|
||||||
part shows the source input, and the right part the printed result.)
|
part shows the source input, and the right part the printed result.)
|
||||||
|
|
||||||
@example|-{#lang scribble/text
|
@example|-{#lang scribble/text
|
||||||
|
@ -58,14 +58,14 @@ part shows the source input, and the right part the printed result.)
|
||||||
feature on top of feature, but
|
feature on top of feature, but
|
||||||
blah blah blah.}-|
|
blah blah blah.}-|
|
||||||
|
|
||||||
Using @seclink["reader"]|{@-forms}|, we can define and use Scheme
|
Using @seclink["reader"]|{@-forms}|, we can define and use Racket
|
||||||
functions.
|
functions.
|
||||||
|
|
||||||
@example|-{#lang scribble/text
|
@example|-{#lang scribble/text
|
||||||
@(require scheme/list)
|
@(require racket/list)
|
||||||
@(define Foo "Preprocessing")
|
@(define Foo "Preprocessing")
|
||||||
@(define (3x . x)
|
@(define (3x . x)
|
||||||
;; scheme syntax here
|
;; racket syntax here
|
||||||
(add-between (list x x x) " "))
|
(add-between (list x x x) " "))
|
||||||
@Foo languages should
|
@Foo languages should
|
||||||
be designed not by piling
|
be designed not by piling
|
||||||
|
@ -77,10 +77,10 @@ functions.
|
||||||
feature on top of feature, but
|
feature on top of feature, but
|
||||||
blah blah blah.}-|
|
blah blah blah.}-|
|
||||||
|
|
||||||
As demonstrated in this case, the @scheme[output] function simply
|
As demonstrated in this case, the @racket[output] function simply
|
||||||
scans nested list structures recursively, which makes them convenient
|
scans nested list structures recursively, which makes them convenient
|
||||||
for function results. In addition, @scheme[output] prints most values
|
for function results. In addition, @racket[output] prints most values
|
||||||
similarly to @scheme[display] --- notable exceptions are void and
|
similarly to @racket[display] --- notable exceptions are void and
|
||||||
false values which cause no output to appear. This can be used for
|
false values which cause no output to appear. This can be used for
|
||||||
convenient conditional output.
|
convenient conditional output.
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ what looks like erroneous indentation. More about this below.)
|
||||||
A better approach is to generate newlines only when needed.
|
A better approach is to generate newlines only when needed.
|
||||||
|
|
||||||
@example|-{#lang scribble/text
|
@example|-{#lang scribble/text
|
||||||
@(require scheme/list)
|
@(require racket/list)
|
||||||
@(define (counts n str)
|
@(define (counts n str)
|
||||||
(add-between
|
(add-between
|
||||||
(for/list ([i (in-range 1 (+ n 1))])
|
(for/list ([i (in-range 1 (+ n 1))])
|
||||||
|
@ -200,9 +200,9 @@ A better approach is to generate newlines only when needed.
|
||||||
3 Mississippi,
|
3 Mississippi,
|
||||||
... and I'm done.}-|
|
... and I'm done.}-|
|
||||||
|
|
||||||
In fact, this is common enough that the @scheme[scribble/text]
|
In fact, this is common enough that the @racket[scribble/text]
|
||||||
language provides a convenient facility: @scheme[add-newlines] is a
|
language provides a convenient facility: @racket[add-newlines] is a
|
||||||
function that is similar to @scheme[add-between] using a newline
|
function that is similar to @racket[add-between] using a newline
|
||||||
string as the default separator, except that false and void values are
|
string as the default separator, except that false and void values are
|
||||||
filtered out before doing so.
|
filtered out before doing so.
|
||||||
|
|
||||||
|
@ -262,9 +262,9 @@ that uses the Scribble @"@"-form syntax.)
|
||||||
|
|
||||||
Because the Scribble reader is uniform, you can use it in place of any
|
Because the Scribble reader is uniform, you can use it in place of any
|
||||||
expression where it is more convenient. (By convention, we use a
|
expression where it is more convenient. (By convention, we use a
|
||||||
plain S-expression syntax when we want a Scheme expression escape, and
|
plain S-expression syntax when we want a Racket expression escape, and
|
||||||
an @"@"-form for expressions that render as text, which, in the
|
an @"@"-form for expressions that render as text, which, in the
|
||||||
@scheme[scribble/text] language, is any value-producing expression.)
|
@racket[scribble/text] language, is any value-producing expression.)
|
||||||
For example, you can use an @"@"-form for a function that you define.
|
For example, you can use an @"@"-form for a function that you define.
|
||||||
|
|
||||||
@example|-{#lang scribble/text
|
@example|-{#lang scribble/text
|
||||||
|
@ -291,7 +291,7 @@ separate text arguments in the S-expression part of an @"@"-form.
|
||||||
Either you're with us, or against us.
|
Either you're with us, or against us.
|
||||||
}-|
|
}-|
|
||||||
|
|
||||||
You can even use @"@"-forms with a Scheme quote or quasiquote as the
|
You can even use @"@"-forms with a Racket quote or quasiquote as the
|
||||||
``head'' part to make it shorter, or use a macro to get grouping of
|
``head'' part to make it shorter, or use a macro to get grouping of
|
||||||
sub-parts without dealing with quotes.
|
sub-parts without dealing with quotes.
|
||||||
|
|
||||||
|
@ -317,11 +317,11 @@ sub-parts without dealing with quotes.
|
||||||
}-|
|
}-|
|
||||||
|
|
||||||
Yet another solution is to look at the text values and split the input
|
Yet another solution is to look at the text values and split the input
|
||||||
arguments based on a specific token. Using @scheme[match] can make it
|
arguments based on a specific token. Using @racket[match] can make it
|
||||||
convenient --- you can even specify the patterns with @"@"-forms.
|
convenient --- you can even specify the patterns with @"@"-forms.
|
||||||
|
|
||||||
@example|-{#lang scribble/text
|
@example|-{#lang scribble/text
|
||||||
@(require scheme/match)
|
@(require racket/match)
|
||||||
@(define (features . text)
|
@(define (features . text)
|
||||||
(match text
|
(match text
|
||||||
[@list{@|1st|@...
|
[@list{@|1st|@...
|
||||||
|
@ -346,11 +346,11 @@ convenient --- you can even specify the patterns with @"@"-forms.
|
||||||
}-|
|
}-|
|
||||||
|
|
||||||
In particular, it is often convenient to split the input by lines,
|
In particular, it is often convenient to split the input by lines,
|
||||||
identified by delimiting @scheme["\n"] strings. Since this can be
|
identified by delimiting @racket["\n"] strings. Since this can be
|
||||||
useful, a @scheme[split-lines] function is provided.
|
useful, a @racket[split-lines] function is provided.
|
||||||
|
|
||||||
@example|-{#lang scribble/text
|
@example|-{#lang scribble/text
|
||||||
@(require scheme/list)
|
@(require racket/list)
|
||||||
@(define (features . text)
|
@(define (features . text)
|
||||||
(add-between (split-lines text)
|
(add-between (split-lines text)
|
||||||
", "))
|
", "))
|
||||||
|
@ -437,9 +437,9 @@ printouts, as the results are rarely desirable.
|
||||||
two1 3}-|
|
two1 3}-|
|
||||||
|
|
||||||
Note that you don't need side-effects if you want infinite output.
|
Note that you don't need side-effects if you want infinite output.
|
||||||
The @scheme[output] function iterates thunks and (composable)
|
The @racket[output] function iterates thunks and (composable)
|
||||||
promises, so you can create a loop that is delayed in either form.
|
promises, so you can create a loop that is delayed in either form.
|
||||||
@; Note: there is some sfs-related problem in mzscheme that makes it not
|
@; Note: there is some sfs-related problem in racket that makes it not
|
||||||
@; run in bounded space, so don't show it for nowx.
|
@; run in bounded space, so don't show it for nowx.
|
||||||
|
|
||||||
@example|-{#lang scribble/text
|
@example|-{#lang scribble/text
|
||||||
|
@ -483,12 +483,12 @@ The Scribble reader ignores indentation spaces in its body. This is
|
||||||
an intentional feature, since you usually do not want an expression to
|
an intentional feature, since you usually do not want an expression to
|
||||||
depend on its position in the source. But the question is how
|
depend on its position in the source. But the question is how
|
||||||
@emph{can} we render some output text with proper indentation. The
|
@emph{can} we render some output text with proper indentation. The
|
||||||
@scheme[output] function achieves that by assigning a special meaning
|
@racket[output] function achieves that by assigning a special meaning
|
||||||
to lists: when a newline is part of a list's contents, it causes the
|
to lists: when a newline is part of a list's contents, it causes the
|
||||||
following text to appear with indentation that corresponds to the
|
following text to appear with indentation that corresponds to the
|
||||||
column position at the beginning of the list. In most cases, this
|
column position at the beginning of the list. In most cases, this
|
||||||
makes the output appear ``as intended'' when lists are used for nested
|
makes the output appear ``as intended'' when lists are used for nested
|
||||||
pieces of text --- either from a literal @scheme[list] expression, or
|
pieces of text --- either from a literal @racket[list] expression, or
|
||||||
an expression that evaluates to a list, or when a list is passed on as
|
an expression that evaluates to a list, or when a list is passed on as
|
||||||
a value; either as a toplevel expression, or as a nested value; either
|
a value; either as a toplevel expression, or as a nested value; either
|
||||||
appearing after spaces, or after other output.
|
appearing after spaces, or after other output.
|
||||||
|
@ -530,11 +530,11 @@ appearing after spaces, or after other output.
|
||||||
(for/list ([i (in-naturals 1)]
|
(for/list ([i (in-naturals 1)]
|
||||||
[item (in-list items)])
|
[item (in-list items)])
|
||||||
@list{@|i|. @item})))
|
@list{@|i|. @item})))
|
||||||
Todo: @enumerate[@list{Install PLT Scheme}
|
Todo: @enumerate[@list{Install Racket}
|
||||||
@list{Hack, hack, hack}
|
@list{Hack, hack, hack}
|
||||||
@list{Profit}].
|
@list{Profit}].
|
||||||
---***---
|
---***---
|
||||||
Todo: 1. Install PLT Scheme;
|
Todo: 1. Install Racket;
|
||||||
2. Hack, hack, hack;
|
2. Hack, hack, hack;
|
||||||
3. Profit.}-|
|
3. Profit.}-|
|
||||||
|
|
||||||
|
@ -697,8 +697,8 @@ appearing after spaces, or after other output.
|
||||||
}-|
|
}-|
|
||||||
|
|
||||||
There are, however, cases when you need more refined control over the
|
There are, however, cases when you need more refined control over the
|
||||||
output. The @scheme[scribble/text] provides a few functions for such
|
output. The @racket[scribble/text] provides a few functions for such
|
||||||
cases. The @scheme[splice] function is used to group together a
|
cases. The @racket[splice] function is used to group together a
|
||||||
number of values but avoid introducing a new indentation context.
|
number of values but avoid introducing a new indentation context.
|
||||||
|
|
||||||
@example|-{#lang scribble/text
|
@example|-{#lang scribble/text
|
||||||
|
@ -723,9 +723,9 @@ number of values but avoid introducing a new indentation context.
|
||||||
end
|
end
|
||||||
}-|
|
}-|
|
||||||
|
|
||||||
The @scheme[disable-prefix] function disables all indentation
|
The @racket[disable-prefix] function disables all indentation
|
||||||
printouts in its contents, including the indentation before the body
|
printouts in its contents, including the indentation before the body
|
||||||
of the @scheme[disable-prefix] value itself. It is useful, for
|
of the @racket[disable-prefix] value itself. It is useful, for
|
||||||
example, to print out CPP directives.
|
example, to print out CPP directives.
|
||||||
|
|
||||||
@example|-{#lang scribble/text
|
@example|-{#lang scribble/text
|
||||||
|
@ -758,7 +758,7 @@ example, to print out CPP directives.
|
||||||
}
|
}
|
||||||
}-|
|
}-|
|
||||||
|
|
||||||
If there are values after a @scheme[disable-prefix] value on the same
|
If there are values after a @racket[disable-prefix] value on the same
|
||||||
line, they will get indented to the goal column (unless the output is
|
line, they will get indented to the goal column (unless the output is
|
||||||
already beyond it).
|
already beyond it).
|
||||||
|
|
||||||
|
@ -807,7 +807,7 @@ already beyond it).
|
||||||
}-|
|
}-|
|
||||||
|
|
||||||
There are cases where each line should be prefixed with some string
|
There are cases where each line should be prefixed with some string
|
||||||
other than a plain indentation. The @scheme[add-prefix] function
|
other than a plain indentation. The @racket[add-prefix] function
|
||||||
causes its contents to be printed using some given string prefix for
|
causes its contents to be printed using some given string prefix for
|
||||||
every line. The prefix gets accumulated to an existing indentation,
|
every line. The prefix gets accumulated to an existing indentation,
|
||||||
and indentation in the contents gets added to the prefix.
|
and indentation in the contents gets added to the prefix.
|
||||||
|
@ -840,11 +840,11 @@ and indentation in the contents gets added to the prefix.
|
||||||
}
|
}
|
||||||
}-|
|
}-|
|
||||||
|
|
||||||
When combining @scheme[add-prefix] and @scheme[disable-prefix] there
|
When combining @racket[add-prefix] and @racket[disable-prefix] there
|
||||||
is an additional value that can be useful: @scheme[flush]. This is a
|
is an additional value that can be useful: @racket[flush]. This is a
|
||||||
value that causes @scheme[output] to print the current indentation and
|
value that causes @racket[output] to print the current indentation and
|
||||||
prefix. This makes it possible to get the ``ignored as a prefix''
|
prefix. This makes it possible to get the ``ignored as a prefix''
|
||||||
property of @scheme[disable-prefix] but only for a nested prefix.
|
property of @racket[disable-prefix] but only for a nested prefix.
|
||||||
|
|
||||||
@example|-{#lang scribble/text
|
@example|-{#lang scribble/text
|
||||||
@(define (comment . text)
|
@(define (comment . text)
|
||||||
|
@ -923,7 +923,7 @@ property of @scheme[disable-prefix] but only for a nested prefix.
|
||||||
|
|
||||||
Using additional files that contain code for your preprocessing is
|
Using additional files that contain code for your preprocessing is
|
||||||
trivial: the preprocessor source is still source code in a module, so
|
trivial: the preprocessor source is still source code in a module, so
|
||||||
you can @scheme[require] additional files with utility functions.
|
you can @racket[require] additional files with utility functions.
|
||||||
|
|
||||||
@example|-{#lang scribble/text
|
@example|-{#lang scribble/text
|
||||||
@(require "itemize.ss")
|
@(require "itemize.ss")
|
||||||
|
@ -933,7 +933,7 @@ you can @scheme[require] additional files with utility functions.
|
||||||
@list{Hack some
|
@list{Hack some
|
||||||
more}]
|
more}]
|
||||||
---***--- itemize.ss
|
---***--- itemize.ss
|
||||||
#lang scheme
|
#lang racket
|
||||||
(provide itemize)
|
(provide itemize)
|
||||||
(define (itemize . items)
|
(define (itemize . items)
|
||||||
(add-between (map (lambda (item)
|
(add-between (map (lambda (item)
|
||||||
|
@ -948,7 +948,7 @@ you can @scheme[require] additional files with utility functions.
|
||||||
more
|
more
|
||||||
}-|
|
}-|
|
||||||
|
|
||||||
Note that the @seclink["at-exp-lang"]{@scheme[at-exp] language} can
|
Note that the @seclink["at-exp-lang"]{@racket[at-exp] language} can
|
||||||
often be useful here, since such files need to deal with texts. Using
|
often be useful here, since such files need to deal with texts. Using
|
||||||
it, it is easy to include a lot of textual content.
|
it, it is easy to include a lot of textual content.
|
||||||
|
|
||||||
|
@ -961,8 +961,8 @@ it, it is easy to include a lot of textual content.
|
||||||
more}]
|
more}]
|
||||||
@summary
|
@summary
|
||||||
---***--- stuff.ss
|
---***--- stuff.ss
|
||||||
#lang at-exp scheme/base
|
#lang at-exp racket/base
|
||||||
(require scheme/list)
|
(require racket/list)
|
||||||
(provide (all-defined-out))
|
(provide (all-defined-out))
|
||||||
(define (itemize . items)
|
(define (itemize . items)
|
||||||
(add-between (map (lambda (item)
|
(add-between (map (lambda (item)
|
||||||
|
@ -983,17 +983,17 @@ it, it is easy to include a lot of textual content.
|
||||||
}-|
|
}-|
|
||||||
|
|
||||||
Of course, the extreme side of this will be to put all of your content
|
Of course, the extreme side of this will be to put all of your content
|
||||||
in a plain Scheme module, using @"@"-forms for convenience. However,
|
in a plain Racket module, using @"@"-forms for convenience. However,
|
||||||
there is no need to use the preprocessor language in this case;
|
there is no need to use the preprocessor language in this case;
|
||||||
instead, you can @scheme[(require scribble/text)], which will get all
|
instead, you can @racket[(require scribble/text)], which will get all
|
||||||
of the bindings that are available in the @scheme[scribble/text]
|
of the bindings that are available in the @racket[scribble/text]
|
||||||
language. Using @scheme[output], switching from a preprocessed files
|
language. Using @racket[output], switching from a preprocessed files
|
||||||
to a Scheme file is very easy ---- choosing one or the other depends
|
to a Racket file is very easy ---- choosing one or the other depends
|
||||||
on whether it is more convenient to write a text file with occasional
|
on whether it is more convenient to write a text file with occasional
|
||||||
Scheme expressions or the other way.
|
Racket expressions or the other way.
|
||||||
|
|
||||||
@example|-{#lang at-exp scheme/base
|
@example|-{#lang at-exp racket/base
|
||||||
(require scribble/text scheme/list)
|
(require scribble/text racket/list)
|
||||||
(define (itemize . items)
|
(define (itemize . items)
|
||||||
(add-between (map (lambda (item)
|
(add-between (map (lambda (item)
|
||||||
@list{* @item})
|
@list{* @item})
|
||||||
|
@ -1026,12 +1026,12 @@ mostly-text file from a preprocessor file. It might be because you
|
||||||
prefer to split the source text to several files, or because you need
|
prefer to split the source text to several files, or because you need
|
||||||
to preprocess a file without even a @litchar{#lang} header (for
|
to preprocess a file without even a @litchar{#lang} header (for
|
||||||
example, an HTML template file that is the result of an external
|
example, an HTML template file that is the result of an external
|
||||||
editor). For these cases, the @scheme[scribble/text] language
|
editor). For these cases, the @racket[scribble/text] language
|
||||||
provides an @scheme[include] form that includes a file in the
|
provides an @racket[include] form that includes a file in the
|
||||||
preprocessor syntax (where the default parsing mode is text).
|
preprocessor syntax (where the default parsing mode is text).
|
||||||
|
|
||||||
@example|-{#lang scribble/text
|
@example|-{#lang scribble/text
|
||||||
@(require scheme/list)
|
@(require racket/list)
|
||||||
@(define (itemize . items)
|
@(define (itemize . items)
|
||||||
(list
|
(list
|
||||||
"<ul>"
|
"<ul>"
|
||||||
|
@ -1074,12 +1074,12 @@ preprocessor syntax (where the default parsing mode is text).
|
||||||
</html>
|
</html>
|
||||||
}-|
|
}-|
|
||||||
|
|
||||||
(Using @scheme[require] with a text file in the @scheme[scribble/text]
|
(Using @racket[require] with a text file in the @racket[scribble/text]
|
||||||
language will not work as intended: using the preprocessor language
|
language will not work as intended: using the preprocessor language
|
||||||
means that the text is displayed when the module is invoked, so the
|
means that the text is displayed when the module is invoked, so the
|
||||||
required file's contents will be printed before any of the requiring
|
required file's contents will be printed before any of the requiring
|
||||||
module's text does. If you find yourself in such a situation, it is
|
module's text does. If you find yourself in such a situation, it is
|
||||||
better to switch to a Scheme-with-@"@"-expressions file as shown
|
better to switch to a Racket-with-@"@"-expressions file as shown
|
||||||
above.)
|
above.)
|
||||||
|
|
||||||
@;FIXME: add more text on `restore-prefix', `set-prefix', `with-writer'
|
@;FIXME: add more text on `restore-prefix', `set-prefix', `with-writer'
|
||||||
|
@ -1087,20 +1087,20 @@ above.)
|
||||||
@;FIXME: add this to the reference section
|
@;FIXME: add this to the reference section
|
||||||
@;@defform[(include filename)]{
|
@;@defform[(include filename)]{
|
||||||
@;
|
@;
|
||||||
@;Preprocess the @scheme[filename] using the same syntax as
|
@;Preprocess the @racket[filename] using the same syntax as
|
||||||
@;@scheme[scribble/text]. This is similar to using @scheme[load] in a
|
@;@racket[scribble/text]. This is similar to using @racket[load] in a
|
||||||
@;namespace that can access names bound in the current file so included
|
@;namespace that can access names bound in the current file so included
|
||||||
@;code can refer to bindings from the including module. Note, however,
|
@;code can refer to bindings from the including module. Note, however,
|
||||||
@;that the including module cannot refer to names that are bound the
|
@;that the including module cannot refer to names that are bound the
|
||||||
@;included file because it is still a plain scheme module---for such
|
@;included file because it is still a plain racket module---for such
|
||||||
@;uses you should still use @scheme[require] as usual.}
|
@;uses you should still use @racket[require] as usual.}
|
||||||
|
|
||||||
|
|
||||||
@; Two random tests
|
@; Two random tests
|
||||||
@example[#:hidden]|-{
|
@example[#:hidden]|-{
|
||||||
#lang scribble/text
|
#lang scribble/text
|
||||||
|
|
||||||
@define[name]{PLT Scheme}
|
@define[name]{Racket}
|
||||||
|
|
||||||
Suggested price list for "@name"
|
Suggested price list for "@name"
|
||||||
|
|
||||||
|
@ -1124,11 +1124,11 @@ above.)
|
||||||
Total: @items-num items
|
Total: @items-num items
|
||||||
Average price: $@|average|.99
|
Average price: $@|average|.99
|
||||||
---***---
|
---***---
|
||||||
Suggested price list for "PLT Scheme"
|
Suggested price list for "Racket"
|
||||||
|
|
||||||
0. PLT Scheme Home edition: $99.99
|
0. Racket Home edition: $99.99
|
||||||
1. PLT Scheme Professional edition: $149.99
|
1. Racket Professional edition: $149.99
|
||||||
2. PLT Scheme Enterprize edition: $349.99
|
2. Racket Enterprize edition: $349.99
|
||||||
|
|
||||||
Total: 3 items
|
Total: 3 items
|
||||||
Average price: $199.99
|
Average price: $199.99
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#lang scheme/base
|
#lang racket/base
|
||||||
|
|
||||||
(require scribble/manual
|
(require scribble/manual
|
||||||
(for-label scheme/base
|
(for-label racket/base
|
||||||
scheme/contract))
|
racket/contract))
|
||||||
|
|
||||||
(provide (all-from-out scribble/manual)
|
(provide (all-from-out scribble/manual)
|
||||||
(for-label (except-out (all-from-out scheme/base
|
(for-label (except-out (all-from-out racket/base
|
||||||
scheme/contract)
|
racket/contract)
|
||||||
#%module-begin))
|
#%module-begin))
|
||||||
refman)
|
refman)
|
||||||
|
|
||||||
|
|
|
@ -37,16 +37,20 @@
|
||||||
";" vc "/PlatformSDK/lib"))))
|
";" vc "/PlatformSDK/lib"))))
|
||||||
|
|
||||||
(require dynext/compile dynext/link mzlib/etc)
|
(require dynext/compile dynext/link mzlib/etc)
|
||||||
(let ([c (build-path (this-expression-source-directory) "foreign-test.c")]
|
(define delete-test-files
|
||||||
[o (build-path (current-directory) "foreign-test.o")]
|
(let ([c (build-path (this-expression-source-directory) "foreign-test.c")]
|
||||||
[so (build-path (current-directory)
|
[o (build-path (current-directory) "foreign-test.o")]
|
||||||
(bytes->path (bytes-append #"foreign-test"
|
[so (build-path (current-directory)
|
||||||
(system-type 'so-suffix))))])
|
(bytes->path (bytes-append #"foreign-test"
|
||||||
(when (file-exists? o) (delete-file o))
|
(system-type 'so-suffix))))])
|
||||||
(when (file-exists? so) (delete-file so))
|
(when (file-exists? o) (delete-file o))
|
||||||
(parameterize ([current-standard-link-libraries '()])
|
(when (file-exists? so) (delete-file so))
|
||||||
(compile-extension #t c o '())
|
(parameterize ([current-standard-link-libraries '()])
|
||||||
(link-extension #t (list o) so)))
|
(compile-extension #t c o '())
|
||||||
|
(link-extension #t (list o) so))
|
||||||
|
(lambda ()
|
||||||
|
(when (file-exists? o) (delete-file o))
|
||||||
|
(when (file-exists? so) (delete-file so)))))
|
||||||
|
|
||||||
(define test-lib (ffi-lib "./foreign-test"))
|
(define test-lib (ffi-lib "./foreign-test"))
|
||||||
|
|
||||||
|
@ -218,6 +222,8 @@
|
||||||
(test #t ptr-equal? #f (ptr-add (ptr-add #f 8) -8))
|
(test #t ptr-equal? #f (ptr-add (ptr-add #f 8) -8))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
(delete-test-files)
|
||||||
|
|
||||||
(report-errs)
|
(report-errs)
|
||||||
|
|
||||||
#| --- ignore everything below ---
|
#| --- ignore everything below ---
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
scribblings/reference/mz
|
scribblings/reference/mz
|
||||||
"utils.ss"
|
"utils.ss"
|
||||||
(for-label unstable/sequence
|
(for-label unstable/sequence
|
||||||
scheme/contract
|
racket/contract
|
||||||
scheme/base))
|
racket/base))
|
||||||
|
|
||||||
@(define the-eval (make-base-eval))
|
@(define the-eval (make-base-eval))
|
||||||
@(the-eval '(require unstable/sequence))
|
@(the-eval '(require unstable/sequence))
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
|
|
||||||
@defproc[(in-syntax [stx syntax?]) sequence?]{
|
@defproc[(in-syntax [stx syntax?]) sequence?]{
|
||||||
Produces a sequence equivalent to @scheme[(syntax->list lst)].
|
Produces a sequence equivalent to @racket[(syntax->list lst)].
|
||||||
@speed[in-syntax "syntax"]
|
@speed[in-syntax "syntax"]
|
||||||
|
|
||||||
@examples[#:eval the-eval
|
@examples[#:eval the-eval
|
||||||
|
@ -28,15 +28,15 @@ Produces a sequence equivalent to @scheme[(syntax->list lst)].
|
||||||
|
|
||||||
@defproc[(in-pairs [seq sequence?]) sequence?]{
|
@defproc[(in-pairs [seq sequence?]) sequence?]{
|
||||||
Produces a sequence equivalent to
|
Produces a sequence equivalent to
|
||||||
@scheme[(in-parallel (sequence-lift car seq) (sequence-lift cdr seq))].
|
@racket[(in-parallel (sequence-lift car seq) (sequence-lift cdr seq))].
|
||||||
}
|
}
|
||||||
|
|
||||||
@defproc[(in-sequence-forever [seq sequence?] [val any/c]) sequence?]{
|
@defproc[(in-sequence-forever [seq sequence?] [val any/c]) sequence?]{
|
||||||
Produces a sequence whose values are the elements of @scheme[seq], followed by @scheme[val] repeated.
|
Produces a sequence whose values are the elements of @racket[seq], followed by @racket[val] repeated.
|
||||||
}
|
}
|
||||||
|
|
||||||
@defproc[(sequence-lift [f procedure?] [seq sequence?]) sequence?]{
|
@defproc[(sequence-lift [f procedure?] [seq sequence?]) sequence?]{
|
||||||
Produces the sequence of @scheme[f] applied to each element of @scheme[seq].
|
Produces the sequence of @racket[f] applied to each element of @racket[seq].
|
||||||
@examples[#:eval the-eval
|
@examples[#:eval the-eval
|
||||||
(for/list ([x (sequence-lift add1 (in-range 10))])
|
(for/list ([x (sequence-lift add1 (in-range 10))])
|
||||||
x)]
|
x)]
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang at-exp scheme/base
|
#lang at-exp racket/base
|
||||||
(require scribble/base scribble/manual scribble/core)
|
(require scribble/base scribble/manual scribble/core)
|
||||||
(provide unstable
|
(provide unstable
|
||||||
unstable-header
|
unstable-header
|
||||||
|
|
Loading…
Reference in New Issue
Block a user