为什么这段代码不能用于prolog

时间:2018-06-05 14:35:19

标签: prolog swi-prolog

<Grid x:Name="grid" Margin="0,0,490,170"> ...

1 个答案:

答案 0 :(得分:3)

SWI-Prolog 7.x将double_quotes标志的默认值从codes更改为string。这显然是导致您描述的问题的原因。如果使用您发布的代码在源文件的顶部添加以下指令:

:- set_prolog_flag(double_quotes, codes).

你应该得到:

?- 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|...] ;