|
From: | Matt Gushee |
Subject: | Re: [Chicken-users] Syntax of case expressions |
Date: | Wed, 27 Feb 2008 20:04:23 -0700 |
User-agent: | Thunderbird 2.0.0.9 (X11/20071212) |
Ivan Raikov wrote:
Remember that in Scheme, (define foo 'a) is a shortcut for (define (define foo (quote a))) -- quote is a special form, and nota 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 firstexample should actually be:(case foo ((a) 1) (else 2))
Wait a minute, though. I understand now why (('a) ...) didn't match, but how is it that ('a ...)isn't a syntax error? Is it because 'a expands to (quote a), and is thus treated by case as a list of the symbols quote and a? And if so, is that correct behavior? After all,
csi> (pair? 'a) #f (as I expected). -- Matt Gushee : Bantam - lightweight file manager : matt.gushee.net/software/bantam/ : : RASCL's A Simple Configuration Language : matt.gushee.net/rascl/ :
[Prev in Thread] | Current Thread | [Next in Thread] |