From tlumley at u.washington.edu  Mon Oct  3 16:22:14 2005
From: tlumley at u.washington.edu (Thomas Lumley)
Date: Mon, 3 Oct 2005 07:22:14 -0700 (PDT)
Subject: [Rd] access to R parse tree for Lisp-style macros?
In-Reply-To: <4341355A.3080001@stats.uwo.ca>
References: <20051003072535.GA28802@tehun.pair.com>
	<4341355A.3080001@stats.uwo.ca>
Message-ID: <Pine.LNX.4.63a.0510030716080.8804@homer22.u.washington.edu>

On Mon, 3 Oct 2005, Duncan Murdoch wrote:

> On 10/3/2005 3:25 AM, Andrew Piskorski wrote:
>> R folks, I'm curious about possible support for Lisp-style macros in
>> R.  I'm aware of the "defmacro" support for S-Plus and R discussed
>> here:
>>
>>   http://www.biostat.wustl.edu/archives/html/s-news/2002-10/msg00064.html
>>
>> but that's really just a syntactic short-cut to the run-time use of
>> substitute() and eval(), which you could manually put into a function
>> yourself if you cared too.  (AKA, not at all equivalent to Lisp
>> macros.)

Well, yes and no.  It is a syntactic shortcut using functions, but what it 
does is manipulate and then evaluate pieces of parse tree.  It doesn't 
have the efficiency under compilation that real macros would, but we don't 
have compilation.  It doesn't have gensyms, but again, R fails to support 
these in a fairly fundamental way, so they have to be faked using 
variables with weird random names.

I have a long-term plan to add real macros, but not until after Luke 
Tierney's byte-code compiler is finished.

 	-thomas



[Rd] access to R parse tree for Lisp-style macros?
Thomas Lumley