Why Prolog code from Wikipedia doesn't run? - PROLOG
This is a discussion on Why Prolog code from Wikipedia doesn't run? - PROLOG ; I am trying to run an example:
http://en.wikipedia.org/wiki/Prolog#Dynamic_programming
I placed this code into the file 'dyna.pl'.
I run gprolog and enter "['dyna']." and am getting the errors:
--- begin screenshot ---
GNU Prolog 1.3.0
By Daniel Diaz
Copyright (C) 1999-2007 ...
-
Why Prolog code from Wikipedia doesn't run?
I am trying to run an example:
http://en.wikipedia.org/wiki/Prolog#Dynamic_programming
I placed this code into the file 'dyna.pl'.
I run gprolog and enter "['dyna']." and am getting the errors:
--- begin screenshot ---
GNU Prolog 1.3.0
By Daniel Diaz
Copyright (C) 1999-2007 Daniel Diaz
| ?- ['dyna.pl'].
compiling /usr/home/yuri/prolog/dyna.pl for byte code...
/usr/home/yuri/prolog/dyna.pl:1:12: syntax error: . or operator
expected after expression
/usr/home/yuri/prolog/dyna.pl:12:4: syntax error: . or operator
expected after expression
--- end screenshot ---
Is the code in Wikipedia wrong?
-
Re: Why Prolog code from Wikipedia doesn't run?
On Mon, 28 Apr 2008 11:39:28 -0700, Visa Inquirer wrote:
> I am trying to run an example:
> http://en.wikipedia.org/wiki/Prolog#Dynamic_programming
>
> I placed this code into the file 'dyna.pl'.
> I run gprolog and enter "['dyna']." and am getting the errors:
>
> --- begin screenshot ---
> GNU Prolog 1.3.0
> By Daniel Diaz
> Copyright (C) 1999-2007 Daniel Diaz
> | ?- ['dyna.pl'].
> compiling /usr/home/yuri/prolog/dyna.pl for byte code...
> /usr/home/yuri/prolog/dyna.pl:1:12: syntax error: . or operator
> expected after expression
> /usr/home/yuri/prolog/dyna.pl:12:4: syntax error: . or operator
> expected after expression
> --- end screenshot ---
>
> Is the code in Wikipedia wrong?
About the 1:12 error:
dynamic is an operator in many Prolog systems, but not in GNU-Prolog.
You are better off NOT using GNU-Prolog generally (I can dwell on this
issue for some more time, but that's exactly what I lack right now).
Use SWI-Prolog instead - download for free - use Google to find it.
Cheers
Bart Demoen
-
Re: Why Prolog code from Wikipedia doesn't run?
On Mon, 28 Apr 2008 20:52:05 +0200
bart demoen <bmd@cs.kuleuven.be> wrote:
>
> About the 1:12 error:
>
> dynamic is an operator in many Prolog systems, but not in GNU-Prolog.
>
Wut?
# grep dynamic */*.pl
Nbin/adD.pl::- dynamic(ahref/4).
Nbin/adD.pl::- dynamic(hit0/1).
Nbin/adD.pl::- dynamic(hit1/2).
Nbin/adD.pl::- dynamic(qval/2).
Nbin/cmmn.pl::- dynamic(pval/2).
Nbin/cmmn.pl::- dynamic(pmpp/2).
Nbin/cmmn.pl::- dynamic(mpp/1).
Nbin/fixer.pl::- dynamic(currentdbp/1).
Nbin/imgv.pl::- dynamic(qval/2).
....
etc.
All code is for gprolog.
Dhu
-
Re: Why Prolog code from Wikipedia doesn't run?
Duncan Patton wrote:
> On Mon, 28 Apr 2008 20:52:05 +0200
> bart demoen <bmd@cs.kuleuven.be> wrote:
>
>
>>About the 1:12 error:
>>
>>dynamic is an operator in many Prolog systems, but not in GNU-Prolog.
>>
>
>
> Wut?
>
> # grep dynamic */*.pl
> Nbin/adD.pl::- dynamic(ahref/4).
> Nbin/adD.pl::- dynamic(hit0/1).
> Nbin/adD.pl::- dynamic(hit1/2).
> Nbin/adD.pl::- dynamic(qval/2).
> Nbin/cmmn.pl::- dynamic(pval/2).
> Nbin/cmmn.pl::- dynamic(pmpp/2).
> Nbin/cmmn.pl::- dynamic(mpp/1).
> Nbin/fixer.pl::- dynamic(currentdbp/1).
> Nbin/imgv.pl::- dynamic(qval/2).
> ...
>
> etc.
>
> All code is for gprolog.
>
> Dhu
Your point being ?
Cheers
Bart Demoen
-
Re: Why Prolog code from Wikipedia doesn't run?
On Tue, 06 May 2008 10:42:04 +0200, Bart Demoen wrote:
> Duncan Patton wrote:
>> On Mon, 28 Apr 2008 20:52:05 +0200
>> bart demoen <bmd@cs.kuleuven.be> wrote:
>>
>>
>>>About the 1:12 error:
>>>
>>>dynamic is an operator in many Prolog systems, but not in GNU-Prolog.
>>>
>>
>>
>> Wut?
>>
>> # grep dynamic */*.pl
>> Nbin/adD.pl::- dynamic(ahref/4).
>> Nbin/adD.pl::- dynamic(hit0/1).
>> Nbin/adD.pl::- dynamic(hit1/2).
>> Nbin/adD.pl::- dynamic(qval/2).
>> Nbin/cmmn.pl::- dynamic(pval/2).
>> Nbin/cmmn.pl::- dynamic(pmpp/2).
>> Nbin/cmmn.pl::- dynamic(mpp/1).
>> Nbin/fixer.pl::- dynamic(currentdbp/1).
>> Nbin/imgv.pl::- dynamic(qval/2).
>> ...
>>
>> etc.
>>
>> All code is for gprolog.
>>
>> Dhu
>
> Your point being ?
>
> Cheers
>
> Bart Demoen
Duncan didn't respond to my question, so I presume he didn't understand it.
So let me answer it myself: there was no point in his "wut" answer.
He showed uses of the functor dynamic/1 but not as an operator.
If he wanted to show that the atom dynamic can be used as a (prefix)
operator (in GNU Prolog) he should have produced uses of the form
:- dynamic foo/3.
Version GNU Prolog 1.3.0 flags such uses as a syntax error.
Cheers
Bart Demoen
-
Re: Why Prolog code from Wikipedia doesn't run?
bart demoen escreveu:
> On Tue, 06 May 2008 10:42:04 +0200, Bart Demoen wrote:
>
[snipped]
>
> Duncan didn't respond to my question, so I presume he didn't understand it.
>
> So let me answer it myself: there was no point in his "wut" answer.
> He showed uses of the functor dynamic/1 but not as an operator.
> If he wanted to show that the atom dynamic can be used as a (prefix)
> operator (in GNU Prolog) he should have produced uses of the form
>
> :- dynamic foo/3.
>
> Version GNU Prolog 1.3.0 flags such uses as a syntax error.
>
I cannot reproduce this on GNU Prolog 1.3.0 (Windows XP [my Linux box is
on maintenance]).
See my post in this thread on April, 28th.
Regards,
--
Cesar Rabak
-
Re: Why Prolog code from Wikipedia doesn't run?
On Fri, 16 May 2008 22:09:15 -0300, Cesar Rabak wrote:
>> :- dynamic foo/3.
>>
>> Version GNU Prolog 1.3.0 flags such uses as a syntax error.
>>
>
> I cannot reproduce this on GNU Prolog 1.3.0 (Windows XP [my Linux box is
> on maintenance]).
>
> See my post in this thread on April, 28th.
I saw your post - I don't think it show the release number of GNU Prolog.
But even if your GNU 1.3.0 on windoze shows it is ok, and my Linux and
MacOS GNU 1.3.0 show it is not, we don't have a conflict. It just shows
that the versions of GNU Prolog 1.3.0 on different platforms behave
differently. That would reflect badly on GNU Prolog, not on you or me.
BTW, I was already beyond the OP's problem - I was just responding to
a non sequitur contribution by Duncan Patton.
Cheers
Bart Demoen
-
Re: Why Prolog code from Wikipedia doesn't run?
On Sat, 17 May 2008 18:49:45 +0200
bart demoen <bmd@cs.kuleuven.be> wrote:
> On Fri, 16 May 2008 22:09:15 -0300, Cesar Rabak wrote:
>
> >> :- dynamic foo/3.
> >>
> >> Version GNU Prolog 1.3.0 flags such uses as a syntax error.
> >>
> >
> > I cannot reproduce this on GNU Prolog 1.3.0 (Windows XP [my Linux box is
> > on maintenance]).
> >
> > See my post in this thread on April, 28th.
>
> I saw your post - I don't think it show the release number of GNU Prolog.
> But even if your GNU 1.3.0 on windoze shows it is ok, and my Linux and
> MacOS GNU 1.3.0 show it is not, we don't have a conflict. It just shows
> that the versions of GNU Prolog 1.3.0 on different platforms behave
> differently. That would reflect badly on GNU Prolog, not on you or me.
>
I was taking shot at your obvious prejudices against GNU prolog.
I figured I'd let it drop, but it's obviously taken on a personal dimension.
Dhu
> BTW, I was already beyond the OP's problem - I was just responding to
> a non sequitur contribution by Duncan Patton.
>
> Cheers
>
> Bart Demoen
-
Re: Why Prolog code from Wikipedia doesn't run?
Duncan Patton wrote:
> I was taking shot at your obvious prejudices against GNU prolog.
I am not aware of prejudices against GNU Prolog - a prejudice is
"An opinion or judgment formed without due examination" - I have done
some investigation of GNU Prolog, and I do not really have a pronounced
opinion or judgement, and even that opinion, I probably never posted in
comp.lang.prolog.
What made you conclude I have obvious prejudices against GNU Prolog ?
Maybe I need to be more careful in my postings in the future.
> I figured I'd let it drop, but it's obviously taken on a personal dimension.
Not for me.
Cheers
Bart Demoen
-
Re: Why Prolog code from Wikipedia doesn't run?
On Wed, 21 May 2008 11:32:38 +0200
Bart Demoen <bmd@cs.kuleuven.ac.be> wrote:
> Duncan Patton wrote:
>
> > I was taking shot at your obvious prejudices against GNU prolog.
>
> I am not aware of prejudices against GNU Prolog - a prejudice is
> "An opinion or judgment formed without due examination" - I have done
> some investigation of GNU Prolog, and I do not really have a pronounced
> opinion or judgement, and even that opinion, I probably never posted in
> comp.lang.prolog.
>
> What made you conclude I have obvious prejudices against GNU Prolog ?
> Maybe I need to be more careful in my postings in the future.
>
>
> > I figured I'd let it drop, but it's obviously taken on a personal dimension.
>
You probably think people are calling you a moron when they use
the term idiot. That's not what's meant in latin. It's no insult
to your intellect.
Dhu
> Not for me.
>
> Cheers
>
> Bart Demoen