Datalog code not working in Racket

201 views Asked by At

I am trying to port this Prolog code to Datalog in Racket, using example at bottom of this page.

#lang datalog

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)?

pathall(X,X,[]).
pathall(X,Y,[X,Z|L]):- arc(X,Z),pathall(Z,Y,L).
pathall(a, d)?

But it is giving this error at [X,Z|L] on last line of code:

read: expected a `]' to close `['

How do I represent a list in Datalog? Thanks for your help.

1

There are 1 answers

2
mat On BEST ANSWER

Datalog is a syntactic subset of Prolog.

In particular, compound terms such as lists are not supported in Datalog.