[racket] Translation of

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Tue Jan 31 15:56:58 EST 2012

Hi Tim,

Here is a version that works, if I understand the test:

(define %conflict-b
  (%let (X Y Color)
        (%rel (Coloring)
              [(Coloring)
               (%adjacent X Y)
               (%color X Color Coloring)
               (%color Y Color Coloring)])))

(%which () (%conflict-b 'a)); expecting #f , got #<procedure>
(%which () (%conflict-b 'b)); expecting '() , got #<procedure>

First, %conflict-b defines a relation and so when it is applied, you
get a Racklog goal. You need to use %which to get the answer about the
goal.

Second, the LHS of each %rel is a pattern to unify with the argument.
Your argument 'a or 'b wouldn't unify with (Coloring X Y Color)
because there is just 1 argument, not 4.

Jay


On Tue, Jan 31, 2012 at 7:19 AM, Tim McKeaveney <macoovacany at hotmail.com> wrote:
> Hello,
>  I've been trying to translate the prolog tutorial  -
> http://www.csupomona.edu/~jrfisher/www/prolog_tutorial/2_1.html   - into
> racklog.
>  I'm stumped at the conflict rule.
>
>  My code attempts are at  http://paste.lisp.org/display/127408
>
>
>  Any hints?
>
>
> Tim
>
>
>
>
>
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users
>



-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93


Posted on the users mailing list.