<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16587" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face="Courier New" size=2>I already tried to answer Dan Gliebold
along this line, but I did not for the following caveat:</FONT></DIV>
<DIV><FONT face="Courier New"><FONT size=2><FONT face="Courier New"
size=2></FONT></FONT></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>(define namespace
(make-namespace))</FONT></DIV>
<DIV><FONT face="Courier New"><FONT size=2><FONT face="Courier New"
size=2></FONT></FONT></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>(define (add-binding name
transformer)<BR> (eval #`(define-syntax #,name #,transformer)
namespace))</FONT></DIV>
<DIV><FONT face="Courier New"><FONT size=2><FONT face="Courier New"
size=2></FONT></FONT></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>(add-binding 'name (syntax-rules () ((_)
(list 'transformer))))</FONT></DIV>
<DIV><FONT face="Courier New" size=2>(eval '(name) namespace)
;--> error: reference to undefined identifier: name</FONT></DIV>
<DIV><FONT face="Courier New"><FONT size=2><FONT face="Courier New"
size=2></FONT></FONT></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>The following does work:</FONT></DIV>
<DIV><FONT face="Courier New"><FONT size=2><FONT face="Courier New"
size=2></FONT></FONT></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>(define namespace
(make-namespace))</FONT></DIV>
<DIV><FONT face="Courier New"><FONT size=2><FONT face="Courier New"
size=2></FONT></FONT></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>(define (add-binding name
transformer)<BR> (eval #`(define-syntax #,name #,transformer)
namespace))</FONT></DIV>
<DIV><FONT face="Courier New"><FONT size=2><FONT face="Courier New"
size=2></FONT></FONT></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>(add-binding #'name (syntax-rules () ((_)
(list 'transformer))))</FONT></DIV>
<DIV><FONT face="Courier New"><FONT size=2><FONT face="Courier New"
size=2>
^^^^^^</FONT></FONT></FONT></DIV>
<DIV><FONT face="Courier New" size=2>(eval '(name) namespace) ;-->
(transfomer) </FONT></DIV>
<DIV><FONT face="Courier New"><FONT size=2><FONT face="Courier New"
size=2></FONT></FONT></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>Jos</FONT></DIV>
<DIV><BR><FONT face="Courier New" size=2>((((lambda(x)((((((x
x)x)x)x)x)x))<BR> (lambda(x)(lambda(y)(x(x y)))))<BR>
(lambda(x)(write x)x))<BR> 'greeting)</FONT></DIV>
<DIV><FONT face="Courier New" size=2>----- Original Message ----- </FONT>
<DIV><FONT face="Courier New" size=2>From: "Matthew Flatt" <</FONT><A
href="mailto:mflatt@cs.utah.edu"><FONT face="Courier New"
size=2>mflatt@cs.utah.edu</FONT></A><FONT face="Courier New"
size=2>></FONT></DIV>
<DIV><FONT face="Courier New" size=2>To: "Dan Liebgold" <</FONT><A
href="mailto:dan.liebgold@gmail.com"><FONT face="Courier New"
size=2>dan.liebgold@gmail.com</FONT></A><FONT face="Courier New"
size=2>></FONT></DIV>
<DIV><FONT face="Courier New" size=2>Cc: <</FONT><A
href="mailto:plt-scheme@list.cs.brown.edu"><FONT face="Courier New"
size=2>plt-scheme@list.cs.brown.edu</FONT></A><FONT face="Courier New"
size=2>></FONT></DIV>
<DIV><FONT face="Courier New" size=2>Sent: Friday, December 14, 2007 4:41
PM</FONT></DIV>
<DIV><FONT face="Courier New" size=2>Subject: Re: [plt-scheme] adding syntax
transfomer to a namespace</FONT></DIV></DIV>
<DIV><FONT face="Courier New"><BR><FONT size=2></FONT></FONT></DIV><FONT
face="Courier New" size=2>> At Thu, 13 Dec 2007 16:25:33 -0800, "Dan
Liebgold" wrote:<BR>>> Is there any way to emulate the behavior of
define-syntax[es] by explicitly<BR>>> defining a transformer in a
namespace? I'd like to store a transformer in<BR>>> a list,
then create a namespace later and add the transformer to it such<BR>>>
that the various expand functions will honor it.<BR>> <BR>> I don't think
there's any alternative to `eval' for that task:<BR>> <BR>> (define
(add-binding name transformer)<BR>> (eval #`(define-syntax
#,name #,transformer)))<BR>> <BR>> All the usual caveats for using `eval'
apply in this case. (Hopefully,<BR>> those caveats will get collected in the
new documentation in the near<BR>> future).<BR>> <BR>> Matthew<BR>>
<BR>> _________________________________________________<BR>> For
list-related administrative tasks:<BR>> </FONT><A
href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme"><FONT
face="Courier New"
size=2>http://list.cs.brown.edu/mailman/listinfo/plt-scheme</FONT></A><BR><FONT
face="Courier New" size=2>></FONT></BODY></HTML>