Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prolog gives error "undefined procedure" when trying to use :-

I'm using SWI-Prolog on Windows and am getting the following error:

14 ?- parent(X, Y) :- child(Y, X).
ERROR: toplevel: Undefined procedure: (:-)/2 (DWIM could not correct)

I'm not entirely sure what's going on, as this worked last week and I am just starting to learn Prolog.

like image 915
Ross Avatar asked Mar 23 '11 10:03

Ross


2 Answers

The FAQ says it all: http://www.swi-prolog.org/FAQ/ToplevelMode.html

You need to create a file and write your program with rules there. The top level command line will only allow you to issue queries.

like image 98
horsh Avatar answered Oct 19 '22 11:10

horsh


You can try it this way

1 ?- assert(a(A,B):-A=B).
true.

2 ?- a(B,c).
B = c.
like image 6
Volodymyr Gubarkov Avatar answered Oct 19 '22 11:10

Volodymyr Gubarkov