bug-prolog
[Top][All Lists]
Advanced

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

Re: nth in latest unstable version


From: Jasper Taylor
Subject: Re: nth in latest unstable version
Date: Fri, 04 Dec 2009 18:02:59 +0000
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

Hi Daniel
OK, that fixed it, but I have another one...in the following examples the variables A,B,C,D,E are not being bound to the list elements when they are matched. They are still free when the call exits.

$ gprolog
GNU Prolog 1.3.2
By Daniel Diaz
Copyright (C) 1999-2009 Daniel Diaz
| ?- append(Z,[A,B,C,D,E],[48,48,48,48,48,48,48,48,49]).

Z = [48,48,48,48]

yes
| ?- trace.
The debugger will first creep -- showing everything (trace)

yes
{trace}
| ?- append(Z,[A,B,C,D,E],[48,48,48,48,48,48,48,48,49]).
1 1 Call: append(_16,[_17,_18,_19,_20,_21],[48,48,48,48,48,48,48,48,...]) ? 1 1 Exit: append([48,48,48,48],[_17,_18,_19,_20,_21],[48,48,48,48,48,48,48,48,...]) ?

Z = [48,48,48,48]

yes
{trace}

...also I am having to make it --without-c-flags because if I allow the build system to use -O3 then I get an error during build:
. . . .
make[1]: Entering directory `/home/jaspert/Build/gprolog-1.3.2/src/Fd2C'
gplc -c --fast-math fd2c.pl

Fatal Error: Segmentation Violation
compilation failed
make[1]: *** [fd2c.o] Error 1
make[1]: Leaving directory `/home/jaspert/Build/gprolog-1.3.2/src/Fd2C'
make: *** [all] Error 1

Thanks for your help
   --Jasper

Daniel Diaz wrote:
Oups...

fixed (I hope :-)) in last snapshot:
http://gprolog.univ-paris1.fr/unstable/gprolog-20091204.tgz

Daniel


Jasper Taylor a écrit :
nth and nth0 do not work when the position is a number but the list is free. Examples (on Ubuntu but MacOS is same I think):

address@hidden:~$ gprolog
GNU Prolog 1.3.2
By Daniel Diaz
Copyright (C) 1999-2009 Daniel Diaz
| ?- nth(1,B,c).

no
| ?- nth0(0,B,c).

no

Working examples:

| ?- nth(A,B,c).

A = 1
B = [c|_] ? ;

A = 2
B = [_,c|_] ? ;

A = 3
B = [_,_,c|_] ?

yes
| ?- nth0(A,B,c).

A = 0
B = [c|_] ?

yes

Cheers
   --Jasper



_______________________________________________
Bug-prolog mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/bug-prolog








reply via email to

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