Martin Schneeweis
2018-07-15 18:36:41 UTC
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
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