[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Strange: listing of Character values instead of the characters themselve
From: |
Peter Karlsson |
Subject: |
Strange: listing of Character values instead of the characters themselves |
Date: |
Mon, 24 Jan 2011 14:36:06 +0100 |
Hello,
I have a short program doing permutations of a list of strings,
and it works ok in Strawberry Prolog.
But for some reason the gnu prolog lists all the character values in a name or
whatever you want to permute. Instead of the Strings themelves.
Of course I could convert that in some way, but I wonder why they
behave differently?
Best Regards,
/Peter Karlsson, Sweden
--------------------------------------------------------------------
%
% 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).
------------------------------------------------------------------------
Peter Karlsson / address@hidden / Täby, Sweden
- Strange: listing of Character values instead of the characters themselves,
Peter Karlsson <=