From jan@swi.psy.uva.nl Tue Feb 26 11:16:19 2002
Received: from there (jan@gollem.swi.psy.uva.nl [145.18.152.30])
	by swi.psy.uva.nl (8.11.6/8.11.2) with SMTP id g1QAGJu10056;
	Tue, 26 Feb 2002 11:16:19 +0100 (MET)
Message-Id: <200202261016.g1QAGJu10056@swi.psy.uva.nl>
Content-Type: text/plain;
  charset="iso-8859-1"
From: Jan Wielemaker <jan@swi.psy.uva.nl>
Organization: SWI, University of Amsterdam
To: zze-PEX SOR balc031 FTRD/DTL/CAE  <pexsor.balc031@rd.francetelecom.com>,
   "'prolog@swi.psy.uva.nl'" <prolog@swi.psy.uva.nl>
Subject: Re: [SWIPL] Problem with dynamic facts
Date: Tue, 26 Feb 2002 11:15:01 +0100
X-Mailer: KMail [version 1.3.2]
References: <91A311FF6A85D3118DDF0060080C3D82025ED502@lat3721.rd.francetelecom.fr>
In-Reply-To: <91A311FF6A85D3118DDF0060080C3D82025ED502@lat3721.rd.francetelecom.fr>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

On Tuesday 26 February 2002 11:01, zze-PEX SOR balc031 FTRD/DTL/CAE wrote:

[Please don't send attachments to the mailinglist]

> I've got a problem with a dynamic declaration of facts!
>
> In a prolog file, I defined a prolog predicate reduce/3 which calls facts
> deduce/5.
>
> From my C++ program, I can execute a query calling the predicate
> 'reduce/3'.
>
> If my base of facts is declare in the prolog file, expected result is
> correct.
>
> If facts are declare in my C++ program (with the 'assert/1' prolog
> predicate') instead,
> an exception is raised during execution:
>
> ERROR: Undefined procedure: deduce/5
> ERROR:     However, there are definitions for:
> ERROR:         reduce/3
>
> I think this appears because the 'reduce/3' prolog predicate can't find
> facts 'deduce/5'.
>
> I supposed this predicate should be declared as dynamic.
>
> So, I added the following line in my prolog file:
> :- dynamic
> 	deduce/5.
>
> ... but the expected result is not correct!

Assert/1 creates a predicate dynamic if no such predicate existed, so
the dynamic declaration is good practice, but won't help.  For some
reason the assert/1 call from your C++ program hasn't worked as you
expected, but as you give us no clue how you try to realise the
assert/1 from C++, there is little we can say about it. 

	Cheers --- Jan

