Showing posts with label Prolog. Show all posts
Showing posts with label Prolog. Show all posts

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.

macOS Sierra: Installing SWI-Prolog

Command:

$ brew install swi-prolog


Result:

==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core, homebrew/python).
==> Updated Formulae
flow                           homebrew/python/pyrit          sbt ✔

==> Downloading https://homebrew.bintray.com/bottles/swi-prolog-7.2.3_1.sierra.bottle.tar.g
######################################################################## 100.0%
==> Pouring swi-prolog-7.2.3_1.sierra.bottle.tar.gz
🍺  /usr/local/Cellar/swi-prolog/7.2.3_1: 801 files, 17.6M