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: Daniel Dudley
Subject: Re: Trying to make a generic VC++ function...
Date: Mon, 17 Feb 2003 17:54:27 +0100

----- 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]

Daniel





reply via email to

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