what is the item followed by square bracket in prolog? A relation, a variable, or a function...?

73 Views Asked by At

I am new to prolog, and I was trying to write rules for shortest path finding, I tried many times writing rules like path(X, Y) := ... and they never work as intented, until I find these rules

(path[X,Y]==P) <= ((path[X,Z]==P2) & nextTo(Z,Y) 
                        & (X!=Y) & (X._not_in(P2)) & (Y._not_in(P2)) 
                        & (P==P2+[Z])) 
(path[X,Y]==P) <= nextTo(X,Y) & (P==[]) 

and it works like a charm. The tool is pydatalog.

The rules are very similar with what I have been trying (of course there are other mistakes in my code), but I was keep using round bracket path(X, Y) := .... I have never seen terms followed with square brackets like (path[X,Y]==P) <= ... before, is path[X,Y] a relation? a function? or a term? I googled but coundn't find satisfying answers.

0

There are 0 best solutions below