Вопрос

When I use protocol('execution.txt'). and input some queries, I got some garbage characters in the output file. Is there any way to avoid these characters?

11 ?- beside(block2, X).
X = block3  [1m;[0m
[1;31mfalse.[0m

12 ?- beside(block4, X).
X = block7  [1m;[0m
X = block3  [1m;[0m
[1;31mfalse.[0m

13 ?- beside(block5, X).
[1;31mfalse.[0m

14 ?- above(block1,X).
X = block2  [1m;[0m
[1;31mfalse.[0m

15 ?- above(block2,X).
[1;31mfalse.[0m

16 ?- above(block6,X).
X = block5  [1m;[0m
X = block4  [1m;[0m
[1;31mfalse.[0m

17 ?- noprotocol.
Это было полезно?

Решение

those characters are ANSI terminal control sequences, used to highlight errors, etc etc. To disable it, input

?- set_prolog_flag(color_term, false).

before starting the protocol session. To disable permanently, place the same as a directive in your preference file. I.e. in Unix, place in ~/.plrc

:- set_prolog_flag(color_term, false).

If you use XPCE EMACS, you can edit preferences from menu

Edit\Prolog preferences
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top