Reputation: 111
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?
Upvotes: 8
Views: 18341
Reputation: 1732
In 2022, running SWI-Prolog on Windows 10, the initialisation file is called 'init.pl', and is located on my computer in C:\Users\name\AppData\Roaming\swi-prolog
Upvotes: 0
Reputation: 116
On UNIX terminals, you can simply use the built-in tty_clear
predicate to clear the console.
tty_clear.
Upvotes: 8
Reputation: 111
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.
Upvotes: 2
Reputation: 18663
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').
Upvotes: 4