25

First I load the file with SWI-Prolog

$ swipl file.pl

then I modify the file and save.

Now how do I reload the file like

?- reload

for this modified file.pl?

Rahn
  • 4,787
  • 4
  • 31
  • 57

3 Answers3

38

SWI-Prolog has a predicate make/0 for this purpose:

?- make.

Note that SWI-Prolog has a handy feature for searching the manual for keywords:

?- apropos(reload).

Points you (among other things) to Section 3.3 of the manual: "The test-edit-reload cycle", which mentions this.

Isabelle Newbie
  • 9,258
  • 1
  • 20
  • 32
3

Make will reload all source files that have been changed since they were loaded, but if you need to reload an specific file you can use reload_file:

?- make:reload_file(source_file).
Rafa Moyano
  • 169
  • 2
  • 8
0

The answer I keep coming back here looking for is in the Windows/Emacs environment of SWI Prolog, after editing a file Ctrl-S to save it and Ctrl-C Ctrl-M inside the editor to trigger the reload.

NB. it does not work in the toplevel, where Ctrl-C triggers an interrupt.

From the editreload section in the manual mentioned by Isabella Newbie's answer.

TessellatingHeckler
  • 27,511
  • 4
  • 48
  • 87