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):

jasp...@spacehopper:~$ 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
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-prolog

Reply via email to