[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting started

From: Bartek Wilczynski
Subject: Re: Getting started
Date: Thu, 19 Jun 2003 23:07:39 +0200
User-agent: Internet Messaging Program (IMP) 3.0

I suppose that Your problem is how to run an example from the book. You didn't
state what system you are running, but it doesn't make much difference. 

When you invoke the prolog interpreter, you are in the interactive mode
(indicated by a ?- prompt). If You want to define a predicate, You should
consult a file with it's definition. 

So, assuming You want to define a predicate parent/2 (I believe the first one
from Bratko's book then you should create a file containing the source:

parent(pam, bob).
parent(tom, bob).
parent(tom, liz).
parent(bob, ann).
parent(bob, pat).
parent(pat, jim).

save it in current directory (under windows it would be probably
c:\gnu-prolog\bin) as, let's say, and issue a command:
which is a shortened version of ?- consult(parents).

Then you can issue queries like ?- parent(X,liz). 

If you have something really short and just want to try it quickly, you can use 
?- [user].

which reads from the standard input instead of the file. You can just type your
code finishing with ctrl-D (End of File).

Hope that it will help, but I think You should look into the manual to really
get started. 

   Bartek WilczyƄski

Quoting "Timothy W. Duncan" <address@hidden>:

> Hello.
> I am interested in learning to program in Prolog. I have installed
> Gnu-Prolog on my system, and I have Bratko's Prolog Programming for
> Artificial Intelligence, which seems to start at a suitably basic level. 
> The problem that I am having is that I there is something missing in the
> examples that is required to make Prolog run. I have done some online
> searching in other tutorials, and I haven't seen this explained elsewhere
> either.
> Would someone help jumpstart me onto the road of Prolog productivity?
> Thanks!
> -- Tim Duncan
> _______________________________________________
> Users-prolog mailing list
> address@hidden
> ------------------------------
> Scanned for viruses by MKS_Vir
> Last update: 
> ------------------------------

reply via email to

[Prev in Thread] Current Thread [Next in Thread]