[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] case - should that even work?

From: Martin Schneeweis
Subject: [Chicken-users] case - should that even work?
Date: Sun, 15 Jul 2018 20:36:41 +0200


please can someone explain to me why the following even works?

  (define sym 'b)

  (case sym
    ('a "an 'a'")
    ('b "a 'b'")
    ('c "a 'c'")
    (else "something else")) ; -> a 'b'

The correct case-form for the above example should be:

  (case sym
    ((a) "an 'a'")
    ((b) "a 'b'")
    ((c) "a 'c'")
    (else "something else"))

I know the r5rs document just says "Each <clause> _should_ have the
form ((<datum1> ...) <expression1> <expression2> ...)

Surprisingly my "quote-variant" (which is obviously not in the _should_
form) also works in Racket and Chez (and even mit-scheme - although
they changed the documentation for "case" somewhat
- "Each clause has this form...").


reply via email to

[Prev in Thread] Current Thread [Next in Thread]