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 321cb6a38ca9d5e6f457b293607a89155ecfd17a
parent ef78e027d1a629a8dfb33b72e9cc250cb5607ba9
Author: Wolfgang Corcoran-Mathe <wcm@sigwinch.xyz>
Date:   Wed, 31 Jan 2024 21:12:40 -0500

Reflow.

Diffstat:
Mdoc/r7rs-small/r7rs-small.texinfo | 144++++++++++++++++++++++++++++++++++++++++++-------------------------------------
1 file changed, 76 insertions(+), 68 deletions(-)

diff --git a/doc/r7rs-small/r7rs-small.texinfo b/doc/r7rs-small/r7rs-small.texinfo @@ -1749,20 +1749,19 @@ a core set of features is given in appendix B. @node Binding constructs @subsection Binding constructs -The binding constructs @code{let}, @code{let*}, @code{letrec}, @code{letrec*}, -@code{let-values}, and @code{let*-values} -give Scheme a block structure, like Algol 60. The syntax of the first four -constructs is identical, but they differ in the regions they establish -for their variable bindings. In a @code{let} expression, the initial -values are computed before any of the variables become bound; in a -@code{let*} expression, the bindings and evaluations are performed -sequentially; while in @code{letrec} and @code{letrec*} expressions, -all the bindings are in -effect while their initial values are being computed, thus allowing -mutually recursive definitions. -The @code{let-values} and @code{let*-values} constructs are analogous to @code{let} and @code{let*} -respectively, but are designed to handle multiple-valued expressions, binding -different identifiers to the returned values. +The binding constructs @code{let}, @code{let*}, @code{letrec}, +@code{letrec*}, @code{let-values}, and @code{let*-values} give Scheme a +block structure, like Algol 60. The syntax of the first four constructs is +identical, but they differ in the regions they establish for their variable +bindings. In a @code{let} expression, the initial values are computed before +any of the variables become bound; in a @code{let*} expression, the bindings +and evaluations are performed sequentially; while in @code{letrec} and +@code{letrec*} expressions, all the bindings are in effect while their +initial values are being computed, thus allowing mutually recursive +definitions. The @code{let-values} and @code{let*-values} constructs are +analogous to @code{let} and @code{let*} respectively, but are designed to +handle multiple-valued expressions, binding different identifiers to the +returned values. @deffn syntax let @svar{bindings} @svar{body} @@ -1773,14 +1772,15 @@ Syntax: @svar{Bindings} has the form @end display where each @svar{init} is an expression, and @svar{body} is a sequence of -zero or more definitions followed by a sequence of one or more expressions as described -in @ref{Expressions}. It is an error for a @svar{variable} to appear more than once in the list of -variables being bound. +zero or more definitions followed by a sequence of one or more expressions +as described in @ref{Expressions}. It is an error for a @svar{variable} to +appear more than once in the list of variables being bound. -Semantics: The @svar{init}s are evaluated in the current environment (in some unspecified -order), the @svar{variable}s are bound to fresh locations holding the results, the @svar{body} is -evaluated in the extended environment, and the values of the last expression of @svar{body} -are returned. Each binding of a @svar{variable} has @svar{body} as its region. +Semantics: The @svar{init}s are evaluated in the current environment (in +some unspecified order), the @svar{variable}s are bound to fresh locations +holding the results, the @svar{body} is evaluated in the extended +environment, and the values of the last expression of @svar{body} are +returned. Each binding of a @svar{variable} has @svar{body} as its region. @example @@ -1808,13 +1808,12 @@ Syntax: @svar{Bindings} has the form and @svar{body} is a sequence of zero or more definitions followed by one or more expressions as described in @ref{Expressions}. -Semantics: -The @code{let*} binding construct is similar to @code{let}, but the bindings are performed -sequentially from left to right, and the region of a binding indicated -by @code{(}@svar{variable} @svar{init}@code{)} is that part of the @code{let*} -expression to the right of the binding. Thus the second binding is done -in an environment in which the first binding is visible, and so on. -The @svar{variable}s need not be distinct. +Semantics: The @code{let*} binding construct is similar to @code{let}, but +the bindings are performed sequentially from left to right, and the region +of a binding indicated by @code{(}@svar{variable} @svar{init}@code{)} is +that part of the @code{let*} expression to the right of the binding. Thus +the second binding is done in an environment in which the first binding is +visible, and so on. The @svar{variable}s need not be distinct. @example @@ -1834,16 +1833,19 @@ Syntax: @svar{Bindings} has the form @code{((}@svar{variable@sub{1}} @svar{init@sub{1}}@code{)} @dots{}@code{)}, @end display -and @svar{body} is a sequence of zero or more definitions followed by -one or more expressions as described in @ref{Expressions}. It is an error for a @svar{variable} to -appear more than once in the list of variables being bound. +and @svar{body} is a sequence of zero or more definitions followed by one or +more expressions as described in @ref{Expressions}. It is an error for a +@svar{variable} to appear more than once in the list of variables being +bound. -Semantics: The @svar{variable}s are bound to fresh locations holding unspecified values, the -@svar{init}s are evaluated in the resulting environment (in some unspecified order), each -@svar{variable} is assigned to the result of the corresponding @svar{init}, the @svar{body} is evaluated in -the resulting environment, and the values of the last expression in @svar{body} are returned. -Each binding of a @svar{variable} has the entire letrec expression as its region, making it -possible to define mutually recursive procedures. +Semantics: The @svar{variable}s are bound to fresh locations holding +unspecified values, the @svar{init}s are evaluated in the resulting +environment (in some unspecified order), each @svar{variable} is assigned to +the result of the corresponding @svar{init}, the @svar{body} is evaluated in +the resulting environment, and the values of the last expression in +@svar{body} are returned. Each binding of a @svar{variable} has the entire +letrec expression as its region, making it possible to define mutually +recursive procedures. @example @@ -1862,11 +1864,13 @@ possible to define mutually recursive procedures. @end example -One restriction on @code{letrec} is very important: if it is not possible to evaluate each @svar{init} -without assigning or referring to the value of any @svar{variable}, it is an error. The restriction -is necessary because @code{letrec} is defined in terms of a procedure call where a @code{lambda} -expression binds the @svar{variable}s to the values of the @svar{init}s. In the most common uses of -@code{letrec}, all the @svar{init}s are @code{lambda} expressions and the restriction is satisfied automatically. +One restriction on @code{letrec} is very important: if it is not possible to +evaluate each @svar{init} without assigning or referring to the value of any +@svar{variable}, it is an error. The restriction is necessary because +@code{letrec} is defined in terms of a procedure call where a @code{lambda} +expression binds the @svar{variable}s to the values of the @svar{init}s. In +the most common uses of @code{letrec}, all the @svar{init}s are +@code{lambda} expressions and the restriction is satisfied automatically. @end deffn @deffn syntax letrec* @svar{bindings} @svar{body} @@ -1877,20 +1881,24 @@ Syntax: @svar{Bindings} has the form @code{((}@svar{variable@sub{1}} @svar{init@sub{1}}@code{)} @dots{}@code{)}, @end display -and @svar{body}is a sequence of zero or more definitions followed by -one or more expressions as described in @ref{Expressions}. It is an error for a @svar{variable} to -appear more than once in the list of variables being bound. - -Semantics: The @svar{variable}s are bound to fresh locations, each @svar{variable} is assigned in -left-to-right order to the result of evaluating the corresponding @svar{init} (interleaving -evaluations and assignments), the @svar{body} is evaluated in the resulting environment, and -the values of the last expression in @svar{body} are returned. Despite the left-to-right -evaluation and assignment order, each binding of a @svar{variable} has the entire @code{letrec*} -expression as its region, making it possible to define mutually recursive procedures. - -If it is not possible to evaluate each @svar{init} without assigning or referring to the value of -the corresponding @svar{variable} or the @svar{variable} of any of the bindings that follow it in -@svar{bindings}, it is an error. Another restriction is that it is an error to invoke the +and @svar{body}is a sequence of zero or more definitions followed by one or +more expressions as described in @ref{Expressions}. It is an error for a +@svar{variable} to appear more than once in the list of variables being +bound. + +Semantics: The @svar{variable}s are bound to fresh locations, each +@svar{variable} is assigned in left-to-right order to the result of +evaluating the corresponding @svar{init} (interleaving evaluations and +assignments), the @svar{body} is evaluated in the resulting environment, and +the values of the last expression in @svar{body} are returned. Despite the +left-to-right evaluation and assignment order, each binding of a +@svar{variable} has the entire @code{letrec*} expression as its region, +making it possible to define mutually recursive procedures. + +If it is not possible to evaluate each @svar{init} without assigning or +referring to the value of the corresponding @svar{variable} or the +@svar{variable} of any of the bindings that follow it in @svar{bindings}, it +is an error. Another restriction is that it is an error to invoke the continuation of an @svar{init} more than once. @example @@ -1917,8 +1925,8 @@ continuation of an @svar{init} more than once. @end example -Evaluating @code{(means '(3 (1 4)))} returns three values: 8/3, 2.28942848510666 (approximately), -and 36/19. +Evaluating @code{(means '(3 (1 4)))} returns three values: 8/3, +2.28942848510666 (approximately), and 36/19. @end deffn @deffn syntax let-values @svar{mv binding spec} @svar{body} @@ -1945,8 +1953,8 @@ the extended environment, and the values of the last expression of @svar{body} are returned. Each binding of a @svar{variable} has @svar{body} as its region. -It is an error if the @svar{formals} do not match the number of values returned by the -corresponding @svar{init}. +It is an error if the @svar{formals} do not match the number of values +returned by the corresponding @svar{init}. @example @@ -1964,16 +1972,16 @@ Syntax: @svar{Mv binding spec} has the form @code{((}@svar{formals} @svar{init}@code{)} @dots{}@code{)}, @end display -and @svar{body} is a sequence of zero or more definitions followed by -one or more expressions as described in @ref{Expressions}. In each @svar{formals}, it is an error if -any variable appears more than once. +and @svar{body} is a sequence of zero or more definitions followed by one or +more expressions as described in @ref{Expressions}. In each @svar{formals}, +it is an error if any variable appears more than once. The @code{let*-values} construct is similar to @code{let-values}, but the -@svar{init}s are evaluated and bindings created sequentially from -left to right, with the region of the bindings of each @svar{formals} -including the @svar{init}s to its right as well as @svar{body}. Thus the -second @svar{init} is evaluated in an environment in which the first -set of bindings is visible and initialized, and so on. +@svar{init}s are evaluated and bindings created sequentially from left to +right, with the region of the bindings of each @svar{formals} including the +@svar{init}s to its right as well as @svar{body}. Thus the second +@svar{init} is evaluated in an environment in which the first set of +bindings is visible and initialized, and so on. @example