[Top][All Lists]

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

Re: [Chicken-users] Syntax of case expressions

From: Matt Gushee
Subject: Re: [Chicken-users] Syntax of case expressions
Date: Wed, 27 Feb 2008 20:04:23 -0700
User-agent: Thunderbird (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 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))

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)

(as I expected).

Matt Gushee
: Bantam - lightweight file manager : :
: RASCL's A Simple Configuration Language : :

reply via email to

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