users-prolog
[Top][All Lists]
Advanced

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

RE: I don't understand


From: Brent Fulgham
Subject: RE: I don't understand
Date: Wed, 3 Oct 2001 14:33:06 -0700

Hi Bruno,

> 
> My first contact with the reality of a prolog tool so excuse me for my
> question who I think is ridiculous.
> 
> When I load the file new_main.pl from the ExampleC, there is 
> no problem.  When at the top level I try to write the first
definition,
> that is, "parent(bob,mary).", I have the error :uncaught exception:
> error(existence_error(procedure,parent/2),top_level/0)
> 

When you 'consult' a file, it gets added to the live Prolog database.
So requests on the predecate "parent(bob,mary)." are found and an
answer can be given.

When you type on the top level, it thinks you are asking a question, and
can't find the corresponding fact in the database.

Try doing:

?- asserta(parent(bob, mary)).

(to put the data at the top of the database)

or assertz(parent(bob,mary)). to put it at the end.

After you assert the fact, you can ask questions about it.

-Brent




reply via email to

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