From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marius Vollmer Newsgroups: gmane.lisp.guile.user Subject: Re: case syntax and symbols Date: Tue, 22 Mar 2005 01:53:33 +0100 Message-ID: <87is3k1oxe.fsf@zagadka.de> References: <1111445850.6034.15.camel@vandvndr.physics.uiuc.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1111453630 25623 80.91.229.2 (22 Mar 2005 01:07:10 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 22 Mar 2005 01:07:10 +0000 (UTC) Cc: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Mar 22 02:07:10 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DDXrL-00008s-PS for guile-user@m.gmane.org; Tue, 22 Mar 2005 02:07:04 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DDY8X-0008JZ-Le for guile-user@m.gmane.org; Mon, 21 Mar 2005 20:24:49 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DDY4x-0008EG-V8 for guile-user@gnu.org; Mon, 21 Mar 2005 20:21:08 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DDY4g-00084Y-Nn for guile-user@gnu.org; Mon, 21 Mar 2005 20:20:52 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DDY4g-00082d-53 for guile-user@gnu.org; Mon, 21 Mar 2005 20:20:50 -0500 Original-Received: from [195.253.8.218] (helo=mail.dokom.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DDXeL-0006uS-2i for guile-user@gnu.org; Mon, 21 Mar 2005 19:53:37 -0500 Original-Received: from [195.253.28.10] (helo=zagadka.ping.de) by mail.dokom.net with smtp (Exim 4.34) id 1DDXeI-00016n-Ev for guile-user@gnu.org; Tue, 22 Mar 2005 01:53:34 +0100 Original-Received: (qmail 7632 invoked by uid 1000); 22 Mar 2005 00:53:33 -0000 Original-To: Aaron VanDevender In-Reply-To: <1111445850.6034.15.camel@vandvndr.physics.uiuc.edu> (Aaron VanDevender's message of "Mon, 21 Mar 2005 16:57:30 -0600") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org X-MailScanner-To: guile-user@m.gmane.org Xref: news.gmane.org gmane.lisp.guile.user:4299 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:4299 Aaron VanDevender writes: > Hello, > > I have noticed that guile evaluates the following to #t > > (case 'x > ('x #t) > (else #f)) > > even though R5RS section 4.2.1 seems to say that all of the statements > (besides else) must be of the form ((datum ...) ...). Clearly the symbol > 'x is not a list. What is going on here? It is a bit tricky. The syntax 'x is short for (quote x). This expansion is done by the reader without looking at the context. So, what the evaluator really sees is (case 'x ((quote x) #t) (else #f)) This is indeed in the form required by R5RS, although probably only by accident. As expected, the following also evaluates to true: (case 'quote ('x #t) (else #f)) => #t Also (and don't try this at home kids): (define 'x (* x x)) '2 => 4 -- GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405 _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user