chicken-users
[Top][All Lists]
Advanced

[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

Hi,

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
(https://www.gnu.org/software/mit-scheme/documentation/mit-scheme-ref/Conditionals.html)
- "Each clause has this form...").

lg
Martin



reply via email to

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