2
votes

I want to clear screen inside SWI-prolog console using either keyboard shortcut or command (i guess in Prolog you call that "predicate").

Here is similar question where i kinda find what i need - there is predicate that works for me:

write('\33\[2J').

Is there a better (easier) way to clear screen?

3

3 Answers

3
votes

SWI-Prolog allows the definition of a settings file that is loaded by default at startup. Its name depends on the operating-system. On POSIX systems, it's named .swiplrc. You can simply create or update the file if you're already using it with a definition for a shortcut predicate. For example:

cls :- write('\33\[2J').
3
votes

You can simply use the built-in tty_clear predicate to clear the console.

tty_clear.
0
votes

Thanks for helping me. I was able to solve my problem - in the folder, where i have my .pl file, i added file "swipl.ini"(it's for windows), where i added predicate:

cls :- write('\33\[2J').

Now i can just write inside SWI-prolog terminal "cls." and it works as expected.