users-prolog
[Top][All Lists]
Advanced

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

RE: Trying to make a generic VC++ function...


From: Joseph N. Fiore
Subject: RE: Trying to make a generic VC++ function...
Date: Mon, 17 Feb 2003 13:35:10 -0500

> -----Original Message-----
> From: Daniel Dudley [mailto:address@hidden
> Sent: Monday, February 17, 2003 11:54 AM
> To: Joseph N. Fiore; address@hidden
> Subject: Re: Trying to make a generic VC++ function...
> 
> ----- Original Message -----
> From: "Joseph N. Fiore" <address@hidden>
> To: <address@hidden>
> Sent: Monday, February 17, 2003 2:25 PM
> Subject: Trying to make a generic VC++ function...
> 
> > Forgive my ignorance as I'm very new to GNU-Prolog and prolog
> > in general.
> >
> > I'm trying to make a very generic VC++ function to call Prolog
> > functions.
> > It works with the new_main.pl example, ie when there are only
> > two terms to the function.  But it doesn't work with three terms.
> >
> > I want to call:  plSolve("triple", "?X,bb,cc");
> > and it returns "aa,cc,dd;bb,cc,dd"
> >
> > /* the Prolog file */
> > triple(aa,cc,dd).
> > triple(bb,cc,dd).
> > triple(cc,dd,ee).
> > triple(cc,bb,ee).
> 
> It correctly returns two terms:
> 
>     aa,cc,dd
>     bb,cc,dd
> 
> because you're calling it with a free variable "?X" and two
> constants "bb" and "cc" in the last argument. The predicate
> triple/3 contains two clauses which match the two constants,
> namely the first two clauses.
> 
> If you look close enough at the solution:
> 
>    "aa,cc,dd;bb,cc,dd"
> 
> you'll see a semi-colon, which separates the two answers.
> 
> [snipped]

First:  Thanks for the quick reply.

Second: In the magic of VC++, I closed the project, rebooted, twiddled a
bit and it all runs without a problem.  Donno what the problem was but
it worked itself out.

Lastly:  I miss-stated the situation.  When I said:
> I want to call:  plSolve("triple", "?X,bb,cc");
> and it returns "aa,cc,dd;bb,cc,dd"

I meant I /want it/ to return "aa,cc,dd;bb,cc,dd"
What it was doing was segfaulting whenever it ran Rd_String on a
returned variable argument.

Now to work on the real program!

  --Joe






reply via email to

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