commit fdd6d84fc0e72c45c34527b2a6974e5220bd0a87
parent ef70253f504ffa6a7020909d6454a30266c63640
Author: Wolfgang Corcoran-Mathe <wcm@sigwinch.xyz>
Date: Wed, 31 Jan 2024 23:38:00 -0500
Sequencing: Texify.
Diffstat:
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/doc/r7rs-small/r7rs-small.texinfo b/doc/r7rs-small/r7rs-small.texinfo
@@ -1943,23 +1943,25 @@ bindings is visible and initialized, and so on.
@node Sequencing
@subsection Sequencing
-Both of Scheme's sequencing constructs are named begin, but the two have slightly
+Both of Scheme's sequencing constructs are named @code{begin}, but the two have slightly
different forms and uses:
-syntax: (begin @svar{expression or definition} @dots{})
+@deffn syntax begin @svar{expression or definition}@dots{}
This form of begin can appear as part of a @svar{body}, or at the outermost level of a
-@svar{program}, or at the REPL, or directly nested in a begin that is itself of this form. It causes
-the contained expressions and definitions to be evaluated exactly as if the enclosing begin
+@svar{program}, or at the REPL, or directly nested in a @code{begin} that is itself of this form. It causes
+the contained expressions and definitions to be evaluated exactly as if the enclosing @code{begin}
construct were not present.
-Rationale: This form is commonly used in the output of macros (see section 4.3) which
+Rationale: This form is commonly used in the output of macros (@xref{Macros}) which
need to generate multiple definitions and splice them into the context in which they
are expanded.
-syntax: (begin @svar{expression1} @svar{expression2} @dots{})
+@end deffn
+
+@deffn syntax begin @svar{expression@sub{1}} @svar{expression@sub{2}}@dots{}
-This form of begin can be used as an ordinary expression. The @svar{expression}s are
+This form of @code{begin} can be used as an ordinary expression. The @svar{expression}s are
evaluated sequentially from left to right, and the values of the last @svar{expression} are
returned. This expression type is used to sequence side effects such as assignments or
input and output.
@@ -1969,15 +1971,16 @@ input and output.
(and (= x 0)
(begin (set! x 5)
- (+ x 1))) @result{} 6
+ (+ x 1))) @result{} 6
(begin (display "4 plus 1 equals ")
(display (+ 4 1)))
- @result{}
- unspecified and prints 4 plus 1 equals 5
+ @result{} @r{unspecified}
+@print{} 4 plus 1 equals 5
@end example
-Note that there is a third form of begin used as a library declaration: see section 5.6.1.
+Note that there is a third form of @code{begin} used as a library declaration.
+@xref{Library syntax}
@node Iteration
@subsection Iteration