[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Info-gnuprologjava] Prolog works in GNU Prolog but not in GPJ
From: |
Daniel Thomas |
Subject: |
Re: [Info-gnuprologjava] Prolog works in GNU Prolog but not in GPJ |
Date: |
Fri, 22 Apr 2011 12:55:38 +0100 |
Hello,
So I tried running the programs under the three different prolog
interpreters I have to hand, SWI-Prolog, GNU Prolog, GNU Prolog for
Java. I get the behaviour you indicated in that there is far less text
in the files created by GPJ than in those crated by GNU Prolog. This
probably means there is a bug somewhere.
SWI-Prolog also produces the same output as GNU Prolog once the
memberchk function is commented out (do you want to file a bug report
asking for that to be added and I will put it in the next release).
I would implement memberchk just as you have though without the
trailing ,! as the once/1 function does that for you.
So I am fairly convinced that you have found another bug in GPJ but 700
lines of Prolog is a lot of code for me to read through and try to
understand in order to work out where GPJ is going wrong. Do you think
that you could try finding a smaller example where the same problem is
exhibited? I perfectly understand if you don't want to do that though.
Thank you,
Daniel
On Fri, 2011-04-22 at 00:24 +0200, Daniel Warzecha wrote:
> Hello again,
>
> I'm trying to run a prolog program from Java with GPJ.
>
> The program is works correct in GNU Prolog. GPJ creates the files, but
> only fills the first file correctly. Is there something wrong with the
> program or is there a glitch in GPJ?
>
> I've attached the program for you. There are two variants: One for GNU
> Prolog (ext_...) and one for GPJ.
> You start the program by invoking "start". It gathers some information
> and builds ifKnow(ProcessNr,WhenKnows,ThenKnows)-Facts.
> It also stores status(ProcessNr,Item,Status) facts.
> Then it should export those to a file. It only does it for the first
> file. The others are nearly empty. They shouldn't really be empty.
>
> The differences between the two:
> 1. GPJ uses is_list, GNU Prolog uses list.
> 2. GPJ is used in a different directory and uses a path for the files.
> GNU Prolog doesn't.
> 3. GPJ doesn't know memberchk, so the program for GPJ has its own
> implementation of it. That's probably causing it (?)
>
> How could you implement memberchk anyway?
>
> That is one of the last things I have to do for my thesis, I would be
> very grateful if you could help me. I don't see what's causing this.
>
> Goodbye,
> Daniel W.
signature.asc
Description: This is a digitally signed message part