<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hi,<br><br>OK, here's some code (at bottom) to work with. Use of MATCH seems to cause a lot of<br>problems. Code is actually Scheme translation of some Logo code from an old TLC Logo<br>book (for the Mattel Aquarius no less) authored by John R. Allen.<br><br>Let me know if anything else is needed.<br><br>Michael<br><br>========== Bad output using MATCH and MATCH-FIRST<br><br>Welcome to DrScheme, version 4.1.2 [3m].<br>Language: Swindle; memory limit: 128 megabytes.<br>&gt; (compare '(likes desi lucy) db)<br>#t<br>&gt; (compare '(likes romeo juliet) db)<br>#t<br>&gt; <br><br>========= Output after replacing MATCH with MMATCH and MATCH-FIRST with MMATCH-FIRST<br>========= Here's the untraced output:<br><br>Welcome to DrScheme, version 4.1.2 [3m].<br>Language: Swindle; memory limit: 128 megabytes.<br>&gt; (compare '(likes desi lucy) db)<br>#f<br>&gt; (compare
 '(likes romeo juliet) db)<br>#f<br>&gt; (compare '(likes jack jill) db)<br>#t<br>&gt;<br><br>========= And some traced output:<br><br>&gt; (compare '(likes desi lucy) db)<br>|(compare (likes desi lucy) ((likes minnie mickey) (likes jack jill) (likes daisy donald)))<br>| (mmatch (likes desi lucy) (likes minnie mickey))<br>| |(mmatch-first likes likes)<br>| |#t<br>| (mmatch (desi lucy) (minnie mickey))<br>| |(mmatch-first desi minnie)<br>| |#f<br>| #f<br>|(compare (likes desi lucy) ((likes jack jill) (likes daisy donald)))<br>| (mmatch (likes desi lucy) (likes jack jill))<br>| |(mmatch-first likes likes)<br>| |#t<br>| (mmatch (desi lucy) (jack jill))<br>| |(mmatch-first desi jack)<br>| |#f<br>| #f<br>|(compare (likes desi lucy) ((likes daisy donald)))<br>| (mmatch (likes desi lucy) (likes daisy donald))<br>| |(mmatch-first likes likes)<br>| |#t<br>| (mmatch (desi lucy) (daisy donald))<br>| |(mmatch-first desi daisy)<br>| |#f<br>| #f<br>|(compare (likes
 desi lucy) ())<br>|#f<br>#f<br><br><br>&gt; (compare '(likes jack jill) db)<br>|(compare (likes jack jill) ((likes minnie mickey) (likes jack jill) (likes daisy donald)))<br>| (mmatch (likes jack jill) (likes minnie mickey))<br>| |(mmatch-first likes likes)<br>| |#t<br>| (mmatch (jack jill) (minnie mickey))<br>| |(mmatch-first jack minnie)<br>| |#f<br>| #f<br>|(compare (likes jack jill) ((likes jack jill) (likes daisy donald)))<br>| (mmatch (likes jack jill) (likes jack jill))<br>| |(mmatch-first likes likes)<br>| |#t<br>| (mmatch (jack jill) (jack jill))<br>| |(mmatch-first jack jack)<br>| |#t<br>| (mmatch (jill) (jill))<br>| |(mmatch-first jill jill)<br>| |#t<br>| (mmatch () ())<br>| #t<br>|#t<br>#t<br>&gt;<br><br>========= There's also something screwy going on with the use of Edit|Find and Replace<br>========= that may be associated with the use of MATCH in the code. If I do Edit|Find<br>========= MMATCH and replace it with MATCH (or vice versa) an
 extra blank gets inserted<br>========= at the end of MATCH (or MMATCH going the other way), not a problem with MATCH<br>========= but MATCH-FIRST becomes MATCH -FIRST.<br>&nbsp;<br><br>========= Tracing the code also seems to be messed up when using MATCH.<br><br>========= Here's traced output using MATCH and MATCH-FIRST:<br><br>Welcome to DrScheme, version 4.1.2 [3m].<br>Language: Swindle; memory limit: 128 megabytes.<br>&gt; (compare '(likes desi lucy) db)<br>|(compare (likes desi lucy) ((likes minnie mickey) (likes jack jill) (likes daisy donald)))<br>| (match (likes desi lucy) (likes minnie mickey))<br>| |(match-first likes likes)<br>| |#t<br>| (likes minnie mickey)<br>|#t<br>#t<br>&gt;&nbsp;&nbsp; <br><br>================== This code works:<br><br>(require eopl/eopl)<br><br>(define mmatch<br>&nbsp; (λ (pat1 pat2)<br>&nbsp;&nbsp;&nbsp; (if (null? pat1)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (null?
 pat2)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if (null? pat2)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #f<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if (mmatch-first (car pat1) (car pat2))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (mmatch (cdr pat1) (cdr pat2))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #f)))))<br><br>(define mmatch-first<br>&nbsp; (λ (pat1 pat2)<br>&nbsp;&nbsp;&nbsp; (if (symbol? pat1)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (if (symbol? pat2)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (equal? pat1 pat2)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #f)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (cond ((symbol? pat2) #f)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 ((mmatch-first pat1 (car pat2)) (mmatch (cdr pat1) (cdr pat2)))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (else #f)))))<br><br>(define compare<br>&nbsp; (λ (q db)<br>&nbsp;&nbsp;&nbsp; (cond ((null? db) #f)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (else (cond ((mmatch q (car db)) #t)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (else (compare q (cdr db))))))))<br><br><br>(define db '((likes minnie mickey) (likes jack jill) (likes daisy donald)))<br><br>;(trace compare match&nbsp; match-first)<br><br><br>--- On <b>Mon, 12/28/09, Robby Findler <i>&lt;robby@eecs.northwestern.edu&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Robby Findler &lt;robby@eecs.northwestern.edu&gt;<br>Subject: Re: [plt-scheme] Not so hygienic macros?<br>To:
 "michael rice" &lt;nowgate@yahoo.com&gt;<br>Cc: plt-scheme@list.cs.brown.edu<br>Date: Monday, December 28, 2009, 10:39 AM<br><br><div class="plainMail">That doesn't sound like a lack of hygiene.<br><br>Its hard to tell what is going on without a program, but my guess is<br>that you wrote a program that boils down to this one:<br><br>&nbsp; #lang scheme<br>&nbsp; (set! match 5)<br><br>and the error message is telling you that you're trying to assign to<br>one of the imports to your library.<br><br>Note that if you had written this:<br><br>&nbsp; #lang scheme<br>&nbsp; (define match 6)<br>&nbsp; (set! match 5)<br><br>the definition of 'match' in the body of the module would have<br>shadowed the import and you'd just get the local version of match<br>only.<br><br>hth,<br>Robby<br><br><br>On Mon, Dec 28, 2009 at 9:28 AM, michael rice &lt;<a ymailto="mailto:nowgate@yahoo.com" href="/mc/compose?to=nowgate@yahoo.com">nowgate@yahoo.com</a>&gt;
 wrote:<br>&gt;<br>&gt; I have a function named MATCH and I seem to be mixing it up with underlying macro code. At least that's what I think is happening.<br>&gt;<br>&gt; The error message: set!: cannot mutate syntax identifier in: match<br>&gt;<br>&gt; Must I change the name of my function?<br>&gt;<br>&gt; Michael<br>&gt;<br>&gt;<br>&gt; _________________________________________________<br>&gt; &nbsp;For list-related administrative tasks:<br>&gt; &nbsp;<a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme" target="_blank">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a><br>&gt;<br></div></blockquote></td></tr></table><br>