<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2802" name=GENERATOR></HEAD>
<BODY><!-- Converted from text/plain format -->
<P><FONT size=2><FONT face="Courier New">Hello</FONT></FONT></P>
<P><FONT face=Arial color=#0000ff size=2>If you try the following code, it seems
that the macro sees the list (1 3) in both case but fails to match. In both case
x should be the list (1 3) and not (quote (1 3)). I don't understand why. I
guess the answer is simple but I can't find it after a few hours. </FONT></P>
<P><FONT face=Arial color=#0000ff size=2>Thank you</FONT></P>
<P><FONT size=2><FONT face="Courier New">(define-syntax testListe<BR>
(syntax-rules ()<BR> [(_ (1 3)) #t]<BR> [(_
xxx)<BR> (begin<BR>
(display xxx)<BR>
(newline)<BR> #f)]))<BR><BR><BR>(let ((x
(list 1 3)))<BR> (testListe x))</FONT></FONT></P>
<P><FONT size=2><FONT face="Courier New"><FONT>=> (1 3)<BR>=>
#f<BR></FONT></FONT></FONT></P>
<P><FONT size=2><FONT face="Courier New"><FONT>(define x '(1 3))<BR>(testListe
x)<BR><BR></FONT><FONT size=3>=> </FONT>(1 3)<BR><FONT size=3>=>
</FONT>#f</FONT><BR><BR></FONT><FONT size=2>-----Message d'origine-----<BR>De :
plt-scheme-bounces@list.cs.brown.edu [</FONT><A
href="mailto:plt-scheme-bounces@list.cs.brown.edu"><FONT
size=2>mailto:plt-scheme-bounces@list.cs.brown.edu</FONT></A><FONT size=2>] De
la part de Chongkai Zhu<BR>Envoyé : 19 janvier, 2006 00:30<BR>À :
plt-scheme<BR>Objet : Re: [plt-scheme] Problem with define-syntax<BR><BR>=======
At 2006-01-18, 19:57:10 Andre Mayers wrote: =======<BR><BR>>Good
day<BR>><BR>>I miss something which is surely basic.<BR>>How can I
define a macro that will match a list ?<BR>>Why the following is not working
?<BR>><BR>>(define-syntax testListe<BR>> (syntax-rules
()<BR>> [(_ (1 3)) #t]<BR>> [(_ xxx)
#f]))<BR>><BR>><BR>>(define x '(1 3))<BR>>(testListe
x)<BR>><BR>>Thank you<BR>><BR>>Andre Mayers, Ph.D., professeur
| tel: 819-821-8000x2041<BR>>Departement
d'informatique | fax:
819-821-8200<BR>>Universite de
Sherbrooke |
andre.mayers@usherbrooke.ca<BR>>Sherbrooke
(Quebec)
| </FONT><A href="http://www.dmi.usherb.ca/~amayers"><FONT
size=2>http://www.dmi.usherb.ca/~amayers</FONT></A><BR><FONT size=2>>Canada
J1K 2R1<BR>><BR><BR>You are trying to match (quote (1 3)) with (1
3).<BR><BR>> (testListe (1
3))<BR>#t<BR><BR>-<BR>Chongkai<BR><BR>_________________________________________________<BR>
For list-related administrative tasks:<BR> </FONT><A
href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme"><FONT
size=2>http://list.cs.brown.edu/mailman/listinfo/plt-scheme</FONT></A><BR><BR><BR><BR></P></BODY></HTML>