This example is rewritten from the datalog version.

#lang racket

(require racklog)

(define %edge
  (%rel ()
    [('a 'b)]
    [('b 'c)]
    [('c 'd)]
    [('d 'a)]))

(define %path
  (%rel (X Y)
    [(X Y) (%edge X Y)]
    [(X Y) (%edge X 'Z)
             (%path 'Z Y)]))

(%find-all (X Y) (%path X Y))

It only gives four results.

#lang racklog

edge(a, b).
edge(b, c).
edge(c, d).
edge(d, a).

path(X, Y) :- edge(X, Y).
path(X, Y) :- edge(X, Z), path(Z, Y).

path(X, Y)?

and this version will not terminate.

Thanks in advance.
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to