view 3-Prolog/readme.txt @ 51:178b18b4f9ba

Start experimenting with Prolog
author IBBoard <dev@ibboard.co.uk>
date Mon, 25 Sep 2017 20:49:52 +0100
parents
children 005ae3fad18f
line wrap: on
line source

Installed gprolog from https://software.opensuse.org/package/gprolog

Some documentation says that Prolog may accept a shebang as the first line, but gprolog didn't like it.

Some editors will assume ".pl" means Perl. You may need to change your syntax highlighting.

Running code involves calling "gprolog" without parameters and then running "['filename']." (fullstop terminates the commend).
You can then query it with function calls (e.g. "likes(grommit, sheep)." in the Wallace & Grommit example). Prolog always
returns "yes" or "no" at a prompt when it has finished.

When you ask a question with a placeholder, the placeholder has to be capitalised. Lower-case makes it an atom.
When Prolog returns its answers, type ";" to get the next response. Sometimes Prolog will end multiple responses
with "no", sometimes with "yes". This depends on whether it needs to do more calculations to check for more answers ("no")
or whether it knows it successfully gave you everything ("yes").