From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.user Subject: Re: Need help to understand a macro Date: Fri, 19 Mar 2010 15:28:39 +0100 Message-ID: References: <20100319085701.GA31143@raven.wolf.lan> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1269008907 18703 80.91.229.12 (19 Mar 2010 14:28:27 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 19 Mar 2010 14:28:27 +0000 (UTC) Cc: guile-user@gnu.org To: Josef Wolf Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri Mar 19 15:28:22 2010 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NsdBP-0002Mx-6G for guile-user@m.gmane.org; Fri, 19 Mar 2010 15:28:15 +0100 Original-Received: from localhost ([127.0.0.1]:54112 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NsdBO-0000Vv-16 for guile-user@m.gmane.org; Fri, 19 Mar 2010 10:28:14 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NsdB3-0000Ut-3s for guile-user@gnu.org; Fri, 19 Mar 2010 10:27:53 -0400 Original-Received: from [140.186.70.92] (port=49611 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NsdAy-0000UR-Q9 for guile-user@gnu.org; Fri, 19 Mar 2010 10:27:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NsdAw-0007WD-S0 for guile-user@gnu.org; Fri, 19 Mar 2010 10:27:48 -0400 Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:37012 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NsdAw-0007NN-4L for guile-user@gnu.org; Fri, 19 Mar 2010 10:27:46 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 52A90A3FC5; Fri, 19 Mar 2010 10:26:56 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=NzlDf08F5rq401+07B1nLR/HTsk=; b=tvVqQR KMslQ4n7LlYOOybSch03NZZhLpSKvhKYzVJC/J3ttUsHM+qhF7M8u3UGEwepUHmM JVFDGZMqz2UdPAqLWGCbPBxeSq7PLksXRBoc+RrIQd/ErJtU1EskWtsmtda79WaR fNvMif4KOI9NGJdLmQyBmZj5yOTYvBW/3V9EA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=bUf455EWb2E7PGiDyOKgf3xgs9h/aZSZ u2uqFmgPnqh0D3MV+6Ro3RRloMOmy0sJlPGoqEzaNqj9T8m1bR2uS6guUW5TRSWz uakfIwiMYqCtu5P2IigDcqycaZYI2XfMH+/kplkFhY0F1WxVBsSPllD+r76eAoLw k5kj4eFYXxE= Original-Received: from a-pb-sasl-quonix. (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 3C7DDA3FC4; Fri, 19 Mar 2010 10:26:55 -0400 (EDT) Original-Received: from unquote (unknown [79.151.126.48]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 98BF8A3FC3; Fri, 19 Mar 2010 10:26:53 -0400 (EDT) In-Reply-To: <20100319085701.GA31143@raven.wolf.lan> (Josef Wolf's message of "Fri, 19 Mar 2010 09:57:01 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) X-Pobox-Relay-ID: 77FB6FC8-3363-11DF-99C1-D033EE7EF46B-02397024!a-pb-sasl-quonix.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) 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 Xref: news.gmane.org gmane.lisp.guile.user:7680 Archived-At: Hi, On Fri 19 Mar 2010 09:57, Josef Wolf writes: > (show-expansion (defstruct tree height girth age leaf-shape leaf-color)) (macroexpand '(defstruct ...)) You might want to surround that with (pretty-print ...) from (ice-9 pretty-print). > Of course this is possible. After all, code is data and data is code. Sorta. Syntax-rules/syntax-case macros operate on syntax objects, not on raw s-expressions. This allows them to preserve referential transparency. So the result of expansion might not look like what you would expect. Read up on syntax-rules and syntax-case macros, when you get some time. I used to love defmacros but I don't use them any more. http://git.savannah.gnu.org/gitweb/?p=guile.git;a=blob;f=doc/ref/api-macros.texi;h=51f54ed070af453a138282f61e7cd8dbbddc53a3;hb=HEAD Happy hacking, Andy -- http://wingolog.org/