commit aa9b82d60bb43ccd5885c8b178a0daefa1c7b225
parent f95a2f823ba525e902ceb515274e69733940e313
Author: Wolfgang Corcoran-Mathe <wcm@sigwinch.xyz>
Date: Wed, 31 Jan 2024 17:39:13 -0500
Texify rest of derived conditionals section.
Diffstat:
1 file changed, 64 insertions(+), 47 deletions(-)
diff --git a/doc/r7rs-small/r7rs-small.texinfo b/doc/r7rs-small/r7rs-small.texinfo
@@ -1610,12 +1610,14 @@ procedure are returned by the @code{case} expression.
@end example
-syntax: (and @svar{test1} @dots{})
+@deffn syntax and @svar{test@sub{1}}@dots{}
-Semantics: The @svar{test} expressions are evaluated from left to right, and if any expression
-evaluates to #f (see section 6.3), then #f is returned. Any remaining expressions are not
-evaluated. If all the expressions evaluate to true values, the values of the last expression
-are returned. If there are no expressions, then #t is returned.
+Semantics: The @svar{test} expressions are evaluated from left to right, and if
+any expression evaluates to @code{#f} (@xref{Booleans}), then @code{#f} is returned.
+Any remaining expressions are not evaluated. If all the expressions evaluate to
+true values, the values of the last expression are returned. If there
+are no expressions, then @code{#t} is returned.
+@end deffn
@example
@@ -1626,12 +1628,13 @@ are returned. If there are no expressions, then #t is returned.
@end example
-syntax: (or @svar{test1} @dots{})
+@deffn syntax or @svar{test@sub{1}}@dots{}
Semantics: The @svar{test} expressions are evaluated from left to right, and the value of the
-first expression that evaluates to a true value (see section 6.3) is returned. Any remaining
-expressions are not evaluated. If all expressions evaluate to #f or if there are no
-expressions, then #f is returned.
+first expression that evaluates to a true value (@xref{Booleans}) is returned. Any remaining
+expressions are not evaluated. If all expressions evaluate to @code{#f} or if there are no
+expressions, then @code{#f} is returned.
+@end deffn
@example
@@ -1643,48 +1646,54 @@ expressions, then #f is returned.
@end example
-syntax: (when @svar{test} @svar{expression1} @svar{expression2} @dots{})
+@deffn syntax when @svar{test} @svar{expression1} @svar{expression2}@dots{}
Syntax: The @svar{test} is an expression.
Semantics: The test is evaluated, and if it evaluates to a true value, the expressions are
-evaluated in order. The result of the when expression is unspecified.
+evaluated in order. The result of the @code{when} expression is unspecified.
+@end deffn
-@example
+@display
-(when (= 1 1.0)
- (display "1")
- (display "2")) @result{} unspecified
- and prints 12
+@code{(when (= 1 1.0)}
+@code{ (display "1")}
+@code{ (display "2"))} @result{} unspecified
+ @print{@code{12}}
-@end example
+@end display
-syntax: (unless @svar{test} @svar{expression1} @svar{expression2} @dots{})
+@deffn syntax unless @svar{test} @svar{expression1} @svar{expression2}@dots{}
Syntax: The @svar{test} is an expression.
-Semantics: The test is evaluated, and if it evaluates to #f, the expressions are evaluated in
-order. The result of the unless expression is unspecified.
+Semantics: The test is evaluated, and if it evaluates to @code{#f}, the expressions are evaluated in
+order. The result of the @code{unless} expression is unspecified.
+@end deffn
-@example
+@display
-(unless (= 1 1.0)
- (display "1")
- (display "2")) @result{} unspecified
- and prints nothing
+@code{(unless (= 1 1.0)}
+@code{ (display "1")}
+@code{ (display "2"))} @result{} unspecified
+ @print{nothing}
-@end example
+@end display
-syntax: (cond-expand @svar{ce-clause1} @svar{ce-clause2} @dots{})
+@deffn syntax cond-expand @svar{ce-clause1} @svar{ce-clause2}@dots{}
-Syntax: The cond-expand expression type provides a way to statically expand different
+Syntax: The @code{cond-expand} expression type provides a way to statically expand different
expressions depending on the implementation. A @svar{ce-clause} takes the following form:
-(@svar{feature requirement} @svar{expression} @dots{})
+@display
+@code{(}@svar{feature requirement} @svar{expression} @dots{}@code{)}
+@end display
The last clause can be an ``else clause,'' which has the form
-(else @svar{expression} @dots{})
+@display
+@code{(else }@svar{expression} @dots{}@code{)}
+@end display
A @svar{feature requirement} takes one of the following forms:
@@ -1693,35 +1702,43 @@ A @svar{feature requirement} takes one of the following forms:
@svar{feature identifier}
@item
-(library @svar{library name})
+@code{(library }@svar{library name}@code{)}
@item
-(and @svar{feature requirement} @dots{})
+@code{(and }@svar{feature requirement} @dots{}@code{)}
@item
-(or @svar{feature requirement} @dots{})
+@code{(or }@svar{feature requirement} @dots{}@code{)}
@item
-(not @svar{feature requirement})
+@code{(not }@svar{feature requirement}@code{)}
@end itemize
-Semantics: Each implementation maintains a list of feature identifiers which are present,
-as well as a list of libraries which can be imported. The value of a @svar{feature requirement} is
-determined by replacing each @svar{feature identifier} and (library @svar{library name}) on the
-implementation's lists with #t, and all other feature identifiers and library names with #f,
-then evaluating the resulting expression as a Scheme boolean expression under the
-normal interpretation of and, or, and not.
-
-A cond-expand is then expanded by evaluating the @svar{feature requirement}s of successive
-@svar{ce-clause}s in order until one of them returns #t. When a true clause is found, the
-corresponding @svar{expression}s are expanded to a begin, and the remaining clauses are
-ignored. If none of the @svar{feature requirement}s evaluate to #t, then if there is an else
-clause, its @svar{expression}s are included. Otherwise, the behavior of the cond-expand is
-unspecified. Unlike cond, cond-expand does not depend on the value of any variables.
+Semantics:
+Each implementation maintains a list of feature identifiers which are
+present, as well as a list of libraries which can be imported. The
+value of a @svar{feature requirement} is determined by replacing
+each @svar{feature identifier} and @code{(library }@svar{library name}@code{)}
+on the implementation's lists with @code{#t}, and all other feature
+identifiers and library names with @code{#f}, then evaluating the
+resulting expression as a Scheme boolean expression under the normal
+interpretation of @code{and}, @code{or}, and @code{not}.
+
+A @code{cond-expand} is then expanded by evaluating the
+@svar{feature requirement}s of successive @svar{ce-clause}s
+in order until one of them returns @code{#t}. When a true clause is
+found, the corresponding @svar{expression}s are expanded to a
+@code{begin}, and the remaining clauses are ignored.
+If none of the @svar{feature requirement}s evaluate to @code{#t}, then
+if there is an else clause, its @svar{expression}s are
+included. Otherwise, the behavior of the @code{cond-expand} is unspecified.
+Unlike @code{cond}, @code{cond-expand} does not depend on the value
+of any variables.
The exact features provided are implementation-defined, but for portability a core set of
features is given in appendix B.
+@end deffn
@node Binding constructs
@subsection Binding constructs