Re: How call RAW text with Prolog predicate from C?

<[email protected]>
Newsgroups gmane.comp.gnu.prolog.general
Message-ID <c4d41f2931168149a3ed20ece72c8500@localhost>
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
<[email protected]> 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
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.