SWI-Prolog how to reload workspace?

Viewed 266

I am using standard editor that came with SWI-Prolog. I would like to reload workspace, so that all prior assertions and knowledge base would disappear. Is there short cut for it? I can surely close and re-open editor, but wonder if there is faster way?

1 Answers

I would like to reload workspace, so that all prior assertions and knowledge base would disappear.

IMO to clean a complex environment is not really doable in SWI-Prolog. The database is global, by design, and removing parts of a loaded state is not easy.

But you can store the step used when setup your workspace in ~/.swiplrc, to reconstruct your experience when (re)starting the environment. For instance, in my own, I have

...
user:file_search_path(carlo, '/home/carlo/prolog').
user:file_search_path(scxml, carlo(scxml)).

d :- cd('/home/carlo/prolog'), portray_text(true), edit(read_trace_php).
...

Then, if I 'query' ?- d., SWI-Prolog opens an editor on read_trace_php.pl. If I wrote in my .swiplrc the directive

:- cd('/home/carlo/prolog'), portray_text(true), edit(read_trace_php).

then any time I launched swipl I would get the editor ready.

Facts of the form

user:file_search_path(scxml, carlo(scxml)).

are handy to define the 'include path' required by your project.

You can edit your .swiplrc from > Settings > User init file ...

Related