Saturday, October 29, 2016

macOS Sierra: SWI-Prolog: Hello, World!

Command:

$ cat helloworld.swi


Result:

main :-
write('Hello, World!\n').


Command:

$ swipl


Result:

Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 7.2.3)
Copyright (c) 1990-2015 University of Amsterdam, VU Amsterdam
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.

For help, use ?- help(Topic). or ?- apropos(Word).


Command:

?- ['helloworld.swi'].


Result:

true.


Command:

?- main.


Result:

Hello, World!
true.