Talk:Palindrome detection: Difference between revisions

Content added Content deleted
m (→‎Prolog: cut spurious text from a previous writing, when it did not work because of me)
Line 54: Line 54:
The functions you used for strings are in SWI Prolog, but not in GNU Prolog, so I can't test it, but the "logic" seems logical to me:D --[[User:ShinTakezou|ShinTakezou]] 21:26, 10 February 2009 (UTC)
The functions you used for strings are in SWI Prolog, but not in GNU Prolog, so I can't test it, but the "logic" seems logical to me:D --[[User:ShinTakezou|ShinTakezou]] 21:26, 10 February 2009 (UTC)


Reading here and there I've realized that what we call String in Prolog could be simply called atom, and it exists atom_length/2 and atom_concat/3; but using these instead of string_* in your code gives errors; atom_concat(A1,A2,A3) is true if A3 (unbound atom) is the concatenation of A1 and A2 (bound atoms, i.e. known atoms?).
Reading here and there I've realized that what we call String in Prolog could be simply called atom, and it exists atom_length/2 and atom_concat/3; atom_concat(A1,A2,A3) is true if A3 (unbound atom) is the concatenation of A1 and A2 (bound atoms, i.e. known atoms?).


The code compiles (with gplc, the GNU prolog compiler), but when I try pali('atom'), it says
The code compiles (with gplc, the GNU prolog compiler), but when I try pali('atom'), it says