solve([("ab","abab"), ("b","a"), ("aba","b"), ("aa","a")], Solution)
Answer has been delivered.
SWI-Prolog 7.x changed the default value of the double_quotes
flag from codes
to string
. This is apparently what's causing the problem you describe. If you add, at the top of the source file with the code you posted, the following directive:
:- set_prolog_flag(double_quotes, codes).
You should get:
?- solve([("ab","abab"), ("b","a"), ("aba","b"), ("aa","a")], Solution).
Solution = [4, 4, 2, 1] ;
Solution = [1, 1, 3, 2, 2, 4, 4] ;
Solution = [4, 4, 2, 1, 4, 4, 2, 1] ;
Solution = [1, 1, 3, 2, 2, 4, 3, 4, 2|...] ;
Solution = [1, 1, 3, 2, 2, 4, 4, 4, 4|...] ;