[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How call RAW text with Prolog predicate from C?
From: |
pva |
Subject: |
Re: How call RAW text with Prolog predicate from C? |
Date: |
Tue, 28 Apr 2009 10:37:28 +0600 |
User-agent: |
RoundCube Webmail/0.2a |
Yes, this is so. But the problem is not how to implement(execute, make)
THIS predicate as well as to be able to execute any predicate stored in
string. I think that the interface of this library can not do it.
My aim is Prologue server that can send a text query (a predicate). The
problem in obtaining the correct predicate from the string.
Thank you all, I decided to go to the SWI-Prolog.
(Sorry for my bad English)
On Mon, 27 Apr 2009 15:22:07 +0200, Daniel Diaz
<address@hidden> wrote:
> You are right, the problem comes from:
>
> char str[]="asserta(parent(bob,mary))";
>
> followed by:
>
> Pl_Mk_Atom(Pl_Create_Allocate_Atom(str))
>
> you thus create an atom and not a compound term. You should use instead
> Pl_Mk_Compound instead
> (see http://gprolog.org/manual/html_node/gprolog069.html#toc291)
>
> BTW: since you have 2 nested compound terms (asserta/1 and parent/2) you
> have to first create parent(bob,mary) in a PlTerm variable 'X' and then
> to create asserta(X) into a variable 'goal'. Use Pl_Mk_Compound for both.
>
> Daniel
>