commit f95a2f823ba525e902ceb515274e69733940e313
parent c7532c24f8903e085a092c89735f066135c53518
Author: Wolfgang Corcoran-Mathe <wcm@sigwinch.xyz>
Date: Wed, 31 Jan 2024 17:25:28 -0500
case: Texify.
Diffstat:
1 file changed, 30 insertions(+), 12 deletions(-)
diff --git a/doc/r7rs-small/r7rs-small.texinfo b/doc/r7rs-small/r7rs-small.texinfo
@@ -1551,31 +1551,49 @@ of the last one are returned.
@end example
-syntax: (case @svar{key} @svar{clause1} @svar{clause2} @dots{})
+@deffn syntax case @svar{key} @svar{clause@sub{1}} @svar{clause@sub{2}}@dots{}
Syntax: @svar{Key} can be any expression. Each @svar{clause} has the form
-((@svar{datum1} @dots{}) @svar{expression1} @svar{expression2} @dots{}),where each @svar{datum} is an external
+@display
+@code{((}@svar{datum@sub{1}} @dots{}@code{) }@svar{expression@sub{1}} @svar{expression@sub{2}} @dots{}@code{)},
+@end display
+
+where each @svar{datum} is an external
representation of some object. It is an error if any of the @svar{datum}s are the same
-anywhere in the expression. Alternatively, a @svar{clause} can be of the form ((@svar{datum1} @dots{}) =>
-@svar{expression})The last @svar{clause} can be an ``else clause,'' which has one of the forms (else
-@svar{expression1} @svar{expression2} @dots{})
-or (else => @svar{expression}).
+anywhere in the expression. Alternatively, a @svar{clause} can be of the form
+
+@display
+@code{((}@svar{datum@sub{1}} @dots{})@code{ => }@svar{expression}@code{)}
+@end display
-Semantics: A case expression is evaluated as follows. @svar{Key} is evaluated and its result is
+The last @svar{clause} can be an ``else clause,'' which has one of the forms
+
+@display
+@code{(else }@svar{expression@sub{1}} @svar{expression@sub{2}} @dots{}@code{)}
+@end display
+
+or
+
+@display
+@code{(else => }@svar{expression}@code{)}.
+@end display
+
+Semantics: A @code{case} expression is evaluated as follows. @svar{Key} is evaluated and its result is
compared against each @svar{datum}. If the result of evaluating @svar{key} is the same (in the
-sense of eqv?; see section 6.1) to a @svar{datum}, then the expressions in the corresponding
+sense of @code{eqv?}; @xref{Equivalence predicates}) to a @svar{datum}, then the expressions in the corresponding
@svar{clause} are evaluated in order and the results of the last expression in the @svar{clause} are
-returned as the results of the case expression.
+returned as the results of the @code{case} expression.
If the result of evaluating @svar{key} is different from every @svar{datum}, then if there is an else
-clause, its expressions are evaluated and the results of the last are the results of the case
+clause, its expressions are evaluated and the results of the last are the results of the @code{case}
expression; otherwise the result of the case expression is unspecified.
-If the selected @svar{clause} or else clause uses the => alternate form, then the @svar{expression} is
+If the selected @svar{clause} or else clause uses the @code{=>} alternate form, then the @svar{expression} is
evaluated. It is an error if its value is not a procedure accepting one argument. This
procedure is then called on the value of the @svar{key} and the values returned by this
-procedure are returned by the case expression.
+procedure are returned by the @code{case} expression.
+@end deffn
@example