users-prolog
[Top][All Lists]
Advanced

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

Re: existence error


From: Timo Karjalainen
Subject: Re: existence error
Date: Fri, 22 Nov 2002 16:32:17 +0200 (EET)

On Fri, 22 Nov 2002 address@hidden wrote:

> | ?- test_proc(x).
> uncaught exception: error(existence_error(procedure,test_proc/1),top_level/0)
> | ?- asserta(test_proc(y)).
>
> yes
> | ?- test_proc(x).
>
> no
> | ?-
>
> I expected it would just say "no" the first time.

Are you sure that some clause for test_proc/1 exists at the time of the
first test?

> This "existence error" exception seems to be a violation of how prolog
> should behave.

Not if there is no test_proc/1 defined.

(If you intend test_proc/1 as a "fact", you need a
:- dynamic test_proc/1.
directive. I think you'd get a "no" in that case even if no clauses
for test_proc/1 have ever been asserted or loaded as code.)


-- 
Timo Karjalainen             "I don't have a life.
                              I have a program."
                                   - Star Trek: Voyager






reply via email to

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