Looks good to me.<br>We write a macro for (run #f (q) ...), which we call (run* (q) ...)<br>You might want to add it.<br>... Dan<br><br><div class="gmail_quote">On Sun, Apr 5, 2009 at 3:23 AM, Jon Loldrup <span dir="ltr">&lt;<a href="mailto:loldrup@gmail.com">loldrup@gmail.com</a>&gt;</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;">Well it sure does evaluate successfully now, and testing the first 4 expressions on page 4 in &quot;The Reasoned Schemer&quot; makes them all return the same value as the ones in that book. Only thing is, the book doesn&#39;t mention the definitions of fail and succeed (only that they are longs for #u and #s), so I&#39;m not sure whether this solution is some crude hack or the official way to do it.<br>


<br>Now this code:<div class="im"><br><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">#lang scheme</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">(require (planet dfriedman/miniKanren:1:1/minikanren))</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">(define succeed (== #t #t))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">(define fail (== #t #f))</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">(run #f (q) fail)</span><br style="font-family: courier new,monospace;"></div><span style="font-family: courier new,monospace;">(run #f (q) (== #t q))</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">(run #f (q) fail (== #t q))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">(run #f (q) succeed (== #t q))</span><br>


<br>returns this:<br><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">(#t)</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">(#t)</span><br><br><br clear="all">Jon Loldrup<br>
<br><br><div class="gmail_quote">2009/4/5 Ben Goetter <span dir="ltr">&lt;<a href="mailto:goetter@mazama.net" target="_blank">goetter@mazama.net</a>&gt;</span><div><div></div><div class="h5"><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


Jon Loldrup wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
[...] the third line was taken from the file mktests.scm &lt;<a href="http://kanren.cvs.sourceforge.net/viewvc/kanren/kanren/mini/mktests.scm?revision=1.6&amp;view=markup" target="_blank">http://kanren.cvs.sourceforge.net/viewvc/kanren/kanren/mini/mktests.scm?revision=1.6&amp;view=markup</a>&gt; which I think is designed to test a minikanren implementation.<br>



</blockquote>
That file tests the particular version of minikanren currently on Sourceforge, which is not the same as the version on PLaneT.  You cannot necessarily mix and match the two.  Still, (run #f (q) fail) seems like a reasonable command to issue... isn&#39;t that out of the book?<br>



<br>
Inspecting minikanren.ss reveals that, indeed, it doesn&#39;t export any &quot;fail.&quot;  The mk.scm on Sourceforge includes the following two definitions<br>
<br>
(define succeed (lambdag@ (s) (unit s)))<br>
(define fail (lambdag@ (s) (mzero)))<br>
<br>
which you can&#39;t issue yourself, because the version on PLaneT exports neither lambdag@ nor mzero.  Try instead<div><br>
<br>
#lang scheme<br>
(require (planet dfriedman/miniKanren:1:1/minikanren))<br></div>
(define succeed (== #t #t))<br>
(define fail (== #t #f))<br>
(run #f (q) fail)<br>
<br>
That seems to fail correctly.  I don&#39;t have my copy of TRS at hand, so I can&#39;t opine further.<br>
<br>
Hope that helps,<br><font color="#888888">
Ben<br>
<br>
</font></blockquote></div></div></div><br>
</blockquote></div><br>