commit f075fa74c5b940c70d1573871ce4bbdbf8c8bf96
parent b44f1f5e2cdd52f325ea3475e8291173d7693cb5
Author: Wolfgang Corcoran-Mathe <wcm@sigwinch.xyz>
Date: Tue, 30 Jan 2024 19:02:29 -0500
3.5: Reflow.
Diffstat:
1 file changed, 49 insertions(+), 49 deletions(-)
diff --git a/doc/r7rs-small/r7rs-small.texinfo b/doc/r7rs-small/r7rs-small.texinfo
@@ -1034,31 +1034,33 @@ returned. A formal definition of proper tail recursion can be found in [6].
@subheading Rationale
Intuitively, no space is needed for an active tail call because the
-continuation that is used in the tail call has the same semantics as the continuation
-passed to the procedure containing the call. Although an improper implementation
-might use a new continuation in the call, a return to this new continuation would be
-followed immediately by a return to the continuation passed to the procedure. A
-properly tail-recursive implementation returns to that continuation directly.
-
-Proper tail recursion was one of the central ideas in Steele and Sussman's original
-version of Scheme. Their first Scheme interpreter implemented both functions and
-actors. Control flow was expressed using actors, which differed from functions in
-that they passed their results on to another actor instead of returning to a caller. In
-the terminology of this section, each actor finished with a tail call to another actor.
-
-Steele and Sussman later observed that in their interpreter the code for dealing with
-actors was identical to that for functions and thus there was no need to include both
-in the language.
-
-A @dfn{tail call} is a procedure call that occurs in a tail context. Tail contexts are defined
-inductively. Note that a tail context is always determined with respect to a particular
-lambda expression.
+continuation that is used in the tail call has the same semantics as the
+continuation passed to the procedure containing the call. Although an
+improper implementation might use a new continuation in the call, a return
+to this new continuation would be followed immediately by a return to the
+continuation passed to the procedure. A properly tail-recursive
+implementation returns to that continuation directly.
+
+Proper tail recursion was one of the central ideas in Steele and Sussman's
+original version of Scheme. Their first Scheme interpreter implemented both
+functions and actors. Control flow was expressed using actors, which
+differed from functions in that they passed their results on to another
+actor instead of returning to a caller. In the terminology of this section,
+each actor finished with a tail call to another actor.
+
+Steele and Sussman later observed that in their interpreter the code for
+dealing with actors was identical to that for functions and thus there was
+no need to include both in the language.
+
+A @dfn{tail call} is a procedure call that occurs in a tail context. Tail
+contexts are defined inductively. Note that a tail context is always
+determined with respect to a particular lambda expression.
@itemize
@item
-The last expression within the body of a lambda expression, shown as <tail expression>
-below, occurs in a tail context. The same is true of all the bodies of @code{case-lambda}
-expressions.
+The last expression within the body of a lambda expression, shown as <tail
+expression> below, occurs in a tail context. The same is true of all the
+bodies of @code{case-lambda} expressions.
@example
@@ -1070,11 +1072,12 @@ expressions.
@end example
@item
-If one of the following expressions is in a tail context, then the subexpressions shown
-as <tail expression> are in a tail context. These were derived from rules in the grammar
-given in @ref{Formal syntax and semantics} by replacing some occurrences of <body> with <tail body>, some
-occurrences of <expression> with <tail expression>, and some occurrences of
-<sequence> with <tail sequence>. Only those rules that contain tail contexts are shown
+If one of the following expressions is in a tail context, then the
+subexpressions shown as <tail expression> are in a tail context. These were
+derived from rules in the grammar given in @ref{Formal syntax and semantics}
+by replacing some occurrences of <body> with <tail body>, some occurrences
+of <expression> with <tail expression>, and some occurrences of <sequence>
+with <tail sequence>. Only those rules that contain tail contexts are shown
here.
@c Maybe @format would be better here. FIXME: We still need markup
@@ -1127,25 +1130,24 @@ where
@end display
@item
-If a @code{cond} or @code{case} expression is in a tail context, and has
-a clause of the form @code{(}<expression> @code{=>} <expression>@code{)}
-then the (implied) call to
-the procedure that results from the evaluation of <expression> is in a
-tail context. <expression> itself is not in a tail context.
+If a @code{cond} or @code{case} expression is in a tail context, and has a
+clause of the form @code{(}<expression> @code{=>} <expression>@code{)} then
+the (implied) call to the procedure that results from the evaluation of
+<expression> is in a tail context. <expression> itself is not in a tail
+context.
@end itemize
-Certain procedures defined in this report are also required to perform tail calls.
-The first argument passed to @code{apply} and to
+Certain procedures defined in this report are also required to perform tail
+calls. The first argument passed to @code{apply} and to
@code{call-with-current-continuation}, and the second argument passed to
-@code{call-with-values}, must be called via a tail call.
-Similarly, @code{eval} must evaluate its first argument as if it
-were in tail position within the @code{eval} procedure.
+@code{call-with-values}, must be called via a tail call. Similarly,
+@code{eval} must evaluate its first argument as if it were in tail position
+within the @code{eval} procedure.
-In the following example the only tail call is the call to @code{f}.
-None of the calls to @code{g} or @code{h} are tail calls. The reference to
-@code{x} is in a tail context, but it is not a call and thus is not a
-tail call.
+In the following example the only tail call is the call to @code{f}. None of
+the calls to @code{g} or @code{h} are tail calls. The reference to @code{x}
+is in a tail context, but it is not a call and thus is not a tail call.
@example
@@ -1159,14 +1161,12 @@ tail call.
@subheading Note
-Implementations may
-recognize that some non-tail calls, such as the call to @code{h}
-above, can be evaluated as though they were tail calls.
-In the example above, the @code{let} expression could be compiled
-as a tail call to @code{h}. (The possibility of @code{h} returning
-an unexpected number of values can be ignored, because in that
-case the effect of the @code{let} is explicitly unspecified and
-implementation-dependent.)
+Implementations may recognize that some non-tail calls, such as the call to
+@code{h} above, can be evaluated as though they were tail calls. In the
+example above, the @code{let} expression could be compiled as a tail call to
+@code{h}. (The possibility of @code{h} returning an unexpected number of
+values can be ignored, because in that case the effect of the @code{let} is
+explicitly unspecified and implementation-dependent.)
@node Expressions
@chapter Expressions