Remember that in Scheme, (define foo 'a) is a shortcut for 
(define (define foo (quote a))) -- quote is a special form, and not
a part of the literal. So you in your case statement you are not
matching the symbol a, you are actually matching the symbol 'a (the
apostrophe is treated as a literal in the case statement). Your first
example should actually be: 

(case foo
  ((a) 1)
  (else 2))

Chicken works as expected with that code. 

  -Ivan

Matt Gushee <[EMAIL PROTECTED]> writes:

> Hi, all--
>
> I have just written a 'string-case' macro--it is supposed to behave
> just like case, except that it uses string=? in place of eqv? as its
> equality predicate. But in the course of writing test cases, I have
> encountered a surprise: the Chicken version of case appears to be
> non-compliant with R5RS.
>
> The spec says
>
>   Syntax: <Key> may be any expression. Each <clause> should have the
>     form
>
>   ((<datum1> ...) <expression1> <expression2> ...),
>
> But the syntax implemented in Chicken appears to be
>
>   (<datum> <expression1> <expression2> ...)
>
> E.g.:
>
> csi> (define foo 'a)
> csi> (case foo
> --->    (('a) 1)
> --->    (else 2))
> 2
> csi> (case foo
> --->   ('a 1)
> --->   (else 2))
> 1
>
> Or have I misunderstood something?


_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to