Prolog — Install and use
this is a quick guide on how to get going with swi-prolog. Prolog is a fith generathion “declerative” laungage, it uses facts and rules which can then be quired to give a responce, this sort of thing can used to create Artifical Inteligence (AI). Despite this sounding complicated it is in fact much easier to use and learn (once youve got your head round the way it works) than other (4th generation) laungages such as java and c++.
First of all you need to download it, go to http://www.swi-prolog.org/dl-stable.html and download the version of prolog for you operating system. You can then run the file you have downloaded (follow the instructions) to install it.
Prolog programs are saved as text files, ending in .pl, you should save these into the prolog folder (this was created in my documents during installation) these can then be opened by typing [file without .pl]. rember the dot (.) at the end, in the prolog window.
To run a prolog program you must first open the prolog command thing, from the start menu, programs can then be loaded and run.
Some things to rember about prolog:
>all commands and lines should end in a dot
>leave a line at the end of each file
>reload a file after it has been changed
>dont use capital letters for values only for things in which the value changes
>it wont recognise a calculation unles you use is, X=5+2 doesnt mean X=7 but X is 5+2 does
>a semi collon (;) will show the next result of the query
I dont have a good enough knowlage to write a full tutorial of prolog, only some basic points like those above however a good one is at
http://www.cs.nuim.ie/~jpower/Courses/PROLOG/
anyway enjoy coding
Comments