<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">What is the "Module" language? Don't see it in any of the language selection menus.<br><br>Michael<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: plt-scheme@list.cs.brown.edu<br>Date: Tuesday, December 29, 2009, 2:21 AM<br><br><div class="plainMail">On Mon, Dec 28, 2009 at 9:02 PM, michael rice <<a ymailto="mailto:nowgate@yahoo.com" href="/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></blockquote></td></tr></table><br>