<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><span style="font-family: courier,monaco,monospace,sans-serif;">OK, I'm using #lang scheme and the Module language now.<br><br>But I'm still getting an extra blank inserted when I replace MATCH with MMATCH (see MMATCH- FIRST below). Is the replace function supposed to work this way?<br><br>Michael<br><br>========<br><br>(define mmatch </span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;"> (λ (pat1 pat2)</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;"> (if (null? pat1)</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;"> (null? pat2)</span><br
style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;"> (if (null? pat2)</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;"> #f</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;"> (if (mmatch -first (car pat1) (car pat2))</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span style="font-family: courier,monaco,monospace,sans-serif;"> (match (cdr pat1) (cdr pat2))</span><br style="font-family: courier,monaco,monospace,sans-serif;"><span
style="font-family: courier,monaco,monospace,sans-serif;"> #f)))))</span><br style="font-family: courier,monaco,monospace,sans-serif;"><br><br>--- On <b>Tue, 12/29/09, Robby Findler <i><robby@eecs.northwestern.edu></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Robby Findler <robby@eecs.northwestern.edu><br>Subject: Re: [plt-scheme] Not so hygienic macros?<br>To: "michael rice" <nowgate@yahoo.com><br>Cc: "Shriram Krishnamurthi" <sk@cs.brown.edu>, "plt-scheme" <plt-scheme@list.cs.brown.edu><br>Date: Tuesday, December 29, 2009, 9:17 AM<br><br><div id="yiv378533535">With modules you get error messages (more often) when things won't work. In this case, I'd say it is probably easier to use mzlib/trace instead, tho.<br><br>#lang scheme<br><br>(require
mzlib/trace)<br><br><br>(define (f x)<br>
(if (zero? x)<br> x<br> (+ (f (- x 1)) 1)))<br><br>(trace f)<br>(f 10)<br><br><div class="gmail_quote">On Tue, Dec 29, 2009 at 7:44 AM, michael rice <span dir="ltr"><<a rel="nofollow" ymailto="mailto:nowgate@yahoo.com" target="_blank" href="/mc/compose?to=nowgate@yahoo.com">nowgate@yahoo.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">
Yep, there it was, and somehow I missed it.<br><br>Also, I was using (require eopl/eopl) for tracing. Is that now OK, or still verboten?<br><br>Michael<br><br>--- On <b>Tue, 12/29/09, Shriram Krishnamurthi <i><<a rel="nofollow" ymailto="mailto:sk@cs.brown.edu" target="_blank" href="/mc/compose?to=sk@cs.brown.edu">sk@cs.brown.edu</a>></i></b> wrote:<br>
<blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Shriram Krishnamurthi <<a rel="nofollow" ymailto="mailto:sk@cs.brown.edu" target="_blank" href="/mc/compose?to=sk@cs.brown.edu">sk@cs.brown.edu</a>><div class="im">
<br>Subject: Re: [plt-scheme] Not so hygienic macros?<br>To: "michael rice" <<a rel="nofollow" ymailto="mailto:nowgate@yahoo.com" target="_blank" href="/mc/compose?to=nowgate@yahoo.com">nowgate@yahoo.com</a>><br></div>Cc: "Robby Findler" <<a rel="nofollow" ymailto="mailto:robby@eecs.northwestern.edu" target="_blank" href="/mc/compose?to=robby@eecs.northwestern.edu">robby@eecs.northwestern.edu</a>>, <a rel="nofollow" ymailto="mailto:plt-scheme@list.cs.brown.edu" target="_blank" href="/mc/compose?to=plt-scheme@list.cs.brown.edu">plt-scheme@list.cs.brown.edu</a><br>
Date: Tuesday, December 29, 2009, 8:10 AM<div><div></div><div class="h5"><br><br><div>It's the topmost entry. It looks like it's missing a heading.<br><br><div class="gmail_quote">On Tue, Dec 29, 2009 at 7:29 AM, michael rice <span dir="ltr"><<a rel="nofollow" target="_blank" href="http://mc/compose?to=nowgate@yahoo.com">nowgate@yahoo.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">
What is the "Module" language? Don't see it in any of the language selection menus.<br><br>Michael<div><br><br>--- On <b>Tue, 12/29/09, Robby Findler <i><<a rel="nofollow" target="_blank" href="http://mc/compose?to=robby@eecs.northwestern.edu">robby@eecs.northwestern.edu</a>></i></b> wrote:<br>
</div><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><div><br>From: Robby Findler <<a rel="nofollow" target="_blank" href="http://mc/compose?to=robby@eecs.northwestern.edu">robby@eecs.northwestern.edu</a>><br>
Subject: Re: [plt-scheme] Not so hygienic macros?<br>To: "michael rice" <<a rel="nofollow" target="_blank" href="http://mc/compose?to=nowgate@yahoo.com">nowgate@yahoo.com</a>><br>Cc: <a rel="nofollow" target="_blank" href="http://mc/compose?to=plt-scheme@list.cs.brown.edu">plt-scheme@list.cs.brown.edu</a><br>
</div>Date: Tuesday, December 29, 2009, 2:21 AM<div><div></div><div><br><br><div>On Mon, Dec 28, 2009 at 9:02 PM, michael rice <<a rel="nofollow" target="_blank" href="http://mc/compose?to=nowgate@yahoo.com">nowgate@yahoo.com</a>> wrote:<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>I think you're running into what Matthew calls "hopeless top-level<br>problems". Eli can probably say more about what is going on with the<br>
Swindle language that leads to these precise results.<br><br>In the meatime, I think that if you use the module language, I think<br>you'll find that the program behaves much more sanely. That is, get<br>rid of the eopl require, prefix the program with "#lang scheme", and<br>
use the "Module" language to run the program in DrScheme. When I do<br>that, both versions of the program, the one you posted, and the one<br>below, behave identically on the example inputs you send, namely<br>
producing #f for both of these calls:<br>
<br> (compare '(likes desi lucy) db)<br> (compare '(likes romeo juliet) db)<br><br>hth,<br>Robby<br><br>#lang scheme<br><br>(define match<br> (λ
(pat1 pat2)<br> (if (null? pat1)<br> (null? pat2)<br> (if (null? pat2)<br> #f<br> (if (match-first (car pat1) (car pat2))<br> (match (cdr pat1) (cdr pat2))<br> #f)))))<br>
<br>(define match-first<br> (λ (pat1 pat2)<br> (if (symbol? pat1)<br> (if (symbol? pat2)<br> (equal? pat1 pat2)<br> #f)<br> (cond ((symbol? pat2) #f)<br> ((match-first pat1 (car pat2)) (match (cdr pat1) (cdr pat2)))<br>
(else #f)))))<br><br>(define compare<br> (λ (q
db)<br> (cond ((null? db) #f)<br> (else (cond ((match q (car db)) #t)<br> (else (compare q (cdr db))))))))<br><br>(define db '((likes minnie mickey) (likes jack jill) (likes daisy donald)))<br>
</div></div></div></blockquote></td></tr></tbody></table><br>
<br>_________________________________________________<br>
For list-related administrative tasks:<br>
<a rel="nofollow" target="_blank" href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a><br>
<br></blockquote></div><br>
</div></div></div></blockquote></td></tr></tbody></table><br>
</blockquote></div><br>
</div></blockquote></td></tr></table><br>