r7rs-small-texinfo

Unnamed repository; edit this file 'description' to name the repository.
git clone https://kaka.farm/~git/r7rs-small-texinfo
Log | Files | Refs

commit cafca43f128369a0f235d3a36e290613e70259d9
parent a20a094471ad2ee43a0047d5652b07b30594f94c
Author: Wolfgang Corcoran-Mathe <wcm@sigwinch.xyz>
Date:   Tue,  6 Feb 2024 15:29:56 -0500

Derived expressions impls.: Texify.

Diffstat:
Mdoc/r7rs-small/derived-expressions-implementation.texinfo | 46++++++++++++++++++++++++----------------------
1 file changed, 24 insertions(+), 22 deletions(-)

diff --git a/doc/r7rs-small/derived-expressions-implementation.texinfo b/doc/r7rs-small/derived-expressions-implementation.texinfo @@ -1,9 +1,9 @@ @node Derived expression types formal @section Derived expression types -This section gives syntax definitions for the derived expression types in terms of the -primitive expression types (literal, variable, call, lambda, if, and set!), except for -quasiquote. +This section gives syntax definitions for the derived expression types in +terms of the primitive expression types (literal, variable, call, @code{lambda}, +@code{if}, and @code{set!}), except for @code{quasiquote}. Conditional derived syntax types: @@ -120,7 +120,7 @@ Binding constructs: body1 body2 ...))))) @end lisp -The following letrec macro uses the symbol @svar{undefined} in place of an expression which +The following @code{letrec} macro uses the symbol <undefined> in place of an expression which returns something that when stored in a location makes it an error to try to obtain the value stored in the location. (No such expression is defined in Scheme.) A trick is used to generate the temporary names needed to avoid specifying the order in which the values @@ -140,7 +140,7 @@ are evaluated. This could also be accomplished by using an auxiliary macro. (temp1 ...) ((var1 init1) ...) body ...) - (let ((var1 @svar{undefined}) ...) + (let ((var1 <undefined>) ...) (let ((temp1 init1) ...) (set! var1 temp1) ... @@ -159,7 +159,7 @@ are evaluated. This could also be accomplished by using an auxiliary macro. (define-syntax letrec* (syntax-rules () ((letrec* ((var1 init1) ...) body1 body2 ...) - (let ((var1 @svar{undefined}) ...) + (let ((var1 <undefined>) ...) (set! var1 init1) ... (let () body1 body2 ...))))) @@ -255,9 +255,9 @@ are evaluated. This could also be accomplished by using an auxiliary macro. ((lambda () exp ...))))) @end lisp -The following alternative expansion for begin does not make use of the ability to write +The following alternative expansion for @code{begin} does not make use of the ability to write more than one expression in the body of a lambda expression. In any case, note that -these rules apply only if the body of the begin contains no definitions. +these rules apply only if the body of the @code{begin} contains no definitions. @lisp (define-syntax begin @@ -272,7 +272,7 @@ these rules apply only if the body of the begin contains no definitions. @end lisp The following syntax definition of do uses a trick to expand the variable clauses. As with -letrec above, an auxiliary macro would also work. The expression (if #f #f) is used to +@code{letrec} above, an auxiliary macro would also work. The expression @code{(if #f #f)} is used to obtain an unspecific value. @lisp @@ -300,8 +300,9 @@ obtain an unspecific value. y))) @end lisp -Here is a possible implementation of delay, force and delay-force. We -define the expression + +Here is a possible implementation of @code{delay}, @code{force} and +@code{delay-force}. We define the expression @lisp (delay-force @svar{expression}) @@ -343,7 +344,7 @@ as follows (delay-force (make-promise #t expression))))) @end lisp -where make-promise is defined as follows: +where @code{make-promise} is defined as follows: @lisp (define make-promise @@ -351,10 +352,11 @@ where make-promise is defined as follows: (list (cons done? proc)))) @end lisp -Finally, we define force to call the procedure expressions in promises -iteratively using a trampoline technique following [38] until a -non-lazy result (i.e. a value created by delay instead of delay-force) -is returned, as follows: +Finally, we define @code{force} to call the procedure expressions in +promises iteratively using a trampoline technique following SRFI 45 +until a non-lazy result (i.e.@: a value created by +@code{delay} instead of @code{delay-force}) is returned, as follows: +@c \cite{srfi45} @lisp (define (force promise) @@ -380,8 +382,8 @@ with the following promise accessors: (set-car! new (car old)))) @end lisp -The following implementation of make-parameter and -parameterize is suitable for an implementation with no threads. Parameter objects are +The following implementation of @code{make-parameter} and +@code{parameterize} is suitable for an implementation with no threads. Parameter objects are implemented here as procedures, using two arbitrary unique objects @svar{param-set!} and @svar{param-convert}: @@ -402,7 +404,7 @@ implemented here as procedures, using two arbitrary unique objects @svar{param-s (error "bad parameter syntax")))))) @end lisp -Then parameterize uses dynamic-wind to +Then @code{parameterize} uses @code{dynamic-wind} to dynamically rebind the associated value: @lisp @@ -434,8 +436,8 @@ dynamically rebind the associated value: body)))) @end lisp -The following implementation of guard depends on an auxiliary macro, here called -guard-aux. +The following implementation of @code{guard} depends on an auxiliary macro, here called +@code{guard-aux}. @lisp (define-syntax guard @@ -522,7 +524,7 @@ guard-aux. (cl (params body0 ...) ...))))))) @end lisp -This definition of cond-expand does not interact with the features procedure. It requires +This definition of @code{cond-expand} does not interact with the @code{features} procedure. It requires that each feature identifier provided by the implementation be explicitly mentioned. @lisp