I’m new in Prolog , I am trying to set rule on SWI-Prolog shell e.g –
listensToMusic(X) :- happy(X).
But it prompts –
ERROR: Undefined procedure: (:-)/2
I use SWI-Prolog version 6.2.6
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
SWI-Prolog does not accept new rules and facts on the top-level, it only accepts queries.
Rules are typically added by writing them in a text file (for example
rules.pl), and load it into SWI-Prolog using:Absolute paths to files can be used like this:
You can type rules by issuing
[user]., typing your rule and ending withEOF(typically Ctrl-D):There is an elaborate FAQ on this subject: ERROR: Undefined procedure: (:-)/1 | (:-)/2 | (?-)/1