From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Panagiotis Vossos Newsgroups: gmane.lisp.guile.user Subject: Re: Problem with cond macro. Date: Tue, 16 Apr 2002 12:45:40 +0300 Sender: guile-user-admin@gnu.org Message-ID: References: NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7BIT X-Trace: main.gmane.org 1018954207 3869 127.0.0.1 (16 Apr 2002 10:50:07 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 16 Apr 2002 10:50:07 +0000 (UTC) Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 16xQXG-000103-00 for ; Tue, 16 Apr 2002 12:50:06 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16xQVM-0004YO-00; Tue, 16 Apr 2002 06:48:08 -0400 Original-Received: from mail1.internet.gr ([62.1.1.41]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16xQTs-0004VW-00 for ; Tue, 16 Apr 2002 06:46:36 -0400 Original-Received: from ground.control.net ([62.1.36.84]) by mail1.internet.gr (iPlanet Messaging Server 5.1 (built May 7 2001)) with ESMTP id <0GUN007Z9PXLRZ@mail1.internet.gr> for guile-user@gnu.org; Tue, 16 Apr 2002 13:46:34 +0300 (EEST) Original-Received: (qmail 9203 invoked by uid 501); Tue, 16 Apr 2002 09:45:40 +0000 In-Reply-To: Original-To: guile-user@gnu.org User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 Original-Lines: 51 Errors-To: guile-user-admin@gnu.org X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.user:185 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:185 julian@openit.de (Julian v. Bock) writes: > >>>>> "PV" == Panagiotis Vossos writes: > > PV> Ok, I just started studying macros, so I might be missing > PV> something obvious, but the following example from r5rs doesn't > PV> work correctly with guile: > > guile> (version) > PV> "1.5.6" > guile> (let ((=> #f)) > PV> (cond (#t => 'ok))) standard input:3:10: In expression (cond > PV> (#t => #)): standard input:3:10: Wrong type to apply: ok ABORT: > PV> (misc-error) > > This works only if cond is implemented as a R5RS macro. This is not > guaranteed by the standard though. Maybe, but I used a r5rs macro to implement 'my-cond' and it still didn't work correctly. Here's a simpler case: (define-syntax foo (syntax-rules (=>) ((_ a => b) b) ((_ a b c) (+ a b c)))) (foo 10 => 20) (let ((=> 10)) (foo 10 => 20)) As I understand it, the first use of the macro should return 20 and the second 40 (SCM and s48 indeed return these values). But guile fails on the second one and returns 20. Here's the exact session: guile> (use-modules (ice-9 syncase)) guile> (version) "1.5.6" guile> (define-syntax foo (syntax-rules (=>) ((_ a => b) b) ((_ a b c) (+ a b c)))) (foo 10 => 20) (let ((=> 10)) (foo 10 => 20)) guile> 20 guile> 20 What am I doing wrong ? panagiotis _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://mail.gnu.org/mailman/listinfo/guile-user