[plt-scheme] question from a newbie regarding the import of a library

From: Ben Goetter (goetter at mazama.net)
Date: Sat Apr 4 20:47:55 EDT 2009

Jon Loldrup wrote:
>
> [...] the third line was taken from the file mktests.scm 
> <http://kanren.cvs.sourceforge.net/viewvc/kanren/kanren/mini/mktests.scm?revision=1.6&view=markup> 
> which I think is designed to test a minikanren implementation.
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't that out of the book?

Inspecting minikanren.ss reveals that, indeed, it doesn't export any 
"fail."  The mk.scm on Sourceforge includes the following two definitions

(define succeed (lambdag@ (s) (unit s)))
(define fail (lambdag@ (s) (mzero)))

which you can't issue yourself, because the version on PLaneT exports 
neither lambdag@ nor mzero.  Try instead

#lang scheme
(require (planet dfriedman/miniKanren:1:1/minikanren))
(define succeed (== #t #t))
(define fail (== #t #f))
(run #f (q) fail)

That seems to fail correctly.  I don't have my copy of TRS at hand, so I 
can't opine further.

Hope that helps,
Ben



Posted on the users mailing list.