<div dir="ltr">This example is rewritten from the datalog version.<div><br></div><div>#lang racket</div><div><br></div><div>(require racklog)</div><div><br></div><div><div>(define %edge</div><div> (%rel ()</div><div> [('a 'b)]</div>
<div> [('b 'c)]</div><div> [('c 'd)]</div><div> [('d 'a)]))</div><div><br></div><div>(define %path</div><div> (%rel (X Y)</div><div> [(X Y) (%edge X Y)]</div><div> [(X Y) (%edge X 'Z)</div>
<div> (%path 'Z Y)]))</div><div><br></div><div>(%find-all (X Y) (%path X Y))</div></div><div><br></div><div>It only gives four results.</div><div><br></div><div><div>#lang racklog</div><div><br></div><div>
edge(a, b). </div><div>edge(b, c).</div><div>edge(c, d).</div><div>edge(d, a).</div><div><br></div><div>path(X, Y) :- edge(X, Y).</div><div>path(X, Y) :- edge(X, Z), path(Z, Y).</div><div><br></div><div>path(X, Y)?</div></div>
<div><br></div><div>and this version will not terminate.</div><div><br></div><div>Thanks in advance.</div></div>