~ chicken-core (chicken-5) a36d5d9a4a89496a85d62168e1b46ddd6cf6e408


commit a36d5d9a4a89496a85d62168e1b46ddd6cf6e408
Author:     Peter Bex <peter.bex@xs4all.nl>
AuthorDate: Wed May 29 22:46:31 2013 +0200
Commit:     Peter Bex <peter.bex@xs4all.nl>
CommitDate: Wed May 29 22:46:31 2013 +0200

    Add CASE => syntax to NEWS and manual.

diff --git a/NEWS b/NEWS
index f2d28fcd..fd436872 100644
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,7 @@
      R7RS compatibility.  Being literal constants, they are implicitly quoted.
   - For R7RS compatibility, named character literals #\escape and #\null are
      supported as aliases for #\esc and #\nul.  WRITE will output R7RS names.
+  - The CASE form accepts => proc syntax, like COND (as specified by R7RS).
 
 - Compiler
   - the "inline" declaration does not force inlining anymore as recursive
diff --git a/manual/The R5RS standard b/manual/The R5RS standard
index 6cc85e1c..753c70a3 100644
--- a/manual/The R5RS standard	
+++ b/manual/The R5RS standard	
@@ -256,23 +256,32 @@ Syntax: <Key> may be any expression. Each <clause> should have the form
 
  ((<datum[1]> ...) <expression[1]> <expression[2]> ...),
 
-where each <datum> is an external representation of some object. All
-the <datum>s must be distinct. The last <clause> may be an "else
-clause," which has the form
+where each <datum> is an external representation of some object.
+Alternatively, as per R7RS, a <clause> may be of the form
 
- (else <expression[1]> <expression[2]> ...).
+ ((<datum[1]> ...) => <expression>).
+
+All the <datum>s must be distinct. The last <clause> may be an
+"else clause," which has one of the following two forms:
+
+ (else <expression[1]> <expression[2]> ...)
+ (else => <expression>).      ; R7RS extension
 
 Semantics: A case expression is evaluated as follows. <Key> is
 evaluated and its result is compared against each <datum>. If the
 result of evaluating <key> is equivalent (in the sense of eqv?; see
 section 6.1) to a <datum>, then the expressions in the corresponding
-<clause> are evaluated from left to right and the result(s) of the last
-expression in the <clause> is(are) returned as the result(s) of the
-case expression. If the result of evaluating <key> is different from
-every <datum>, then if there is an else clause its expressions are
-evaluated and the result(s) of the last is(are) the result(s) of the
-case expression; otherwise the result of the case expression is
-unspecified.
+<clause> are evaluated from left to right and the result(s) of the
+last expression in the <clause> is(are) returned as the result(s) of
+the case expression. If the selected <clause> uses the => alternate
+form (an R7RS extension), then the <expression> is evaluated. Its
+value must be a procedure that accepts one argument; this procedure is
+then called on the value of the <key> and the value(s) returned by
+this procedure is(are) returned by the case expression.  If the result
+of evaluating <key> is different from every <datum>, then if there is
+an else clause its expressions are evaluated and the result(s) of the
+last is(are) the result(s) of the case expression; otherwise the
+result of the case expression is unspecified.
 
  (case (* 2 3)
    ((2 3 5 7) 'prime)
Trap