1. Prolog Quick Start

1.1. Prolog code statements end with . a period

Or Run program with-in the prolog REPL:

$ swipl
?- write("hello, world").
?- halt.

1.2. Proglog statements are joined together with , a comma

Or Run program with-in the prolog REPL:

$ swipl
?- write("hello, world"), write(" and that's a wrap.").
?- halt.

1.3. A prolog program file ends with a .pl

Make a prolog program file:

$ mkdir prolog_hello
$ cat << EOF > prolog_hello/hello.pl
write("hello, world").
EOF

1.4. Run a prolog program

  • From the command line

$ swipl -s prolog_hello/hello.pl
  • from with-in the prolog REPL:

$ swipl
?- [prolog_hello/hello]
?- halt.