Hello,

In GNU-Prolog a string is a simple notation of a list of character codes (as in most Prolog implementations). You should use atoms instead of string. For instance replace your example/1 fact by:

example(['Peter','Diva','Ex','Newt','Xtra']).

And everything is OK. Alternatively you can use format('~s',[ "my string" ]) to display a string (but you have to do it for each element of the list Perm).

Daniel


Le 24/01/2011 14:36, Peter Karlsson a écrit :
%
% Testing permute&  select
%

test :- example(Ex), permutation(Ex, Perm),
      write(Perm), nl, fail.
test :- true.

example(["Peter","Diva","Ex","Newt","Xtra"]).


% Permutation&  Select

%permutation(Xs, [Z|Zs]) :- select(Z, Xs, Ys), %permutation(Ys, Zs).
%permutation([],[]).

%select(X, [X|Xs], Xs).
%select(X, [Y|Ys], [Y|Zs]) :- select(X, Ys, Zs).




_______________________________________________
Bug-prolog mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-prolog

Reply via email to