Skip to content

(Re)loading files in the REPL #2504

Answered by bakaq
ocharles asked this question in Q&A
Aug 26, 2024 · 3 comments · 1 reply
Discussion options

You must be logged in to vote

You can just consult/1 it, or use_module/1:

?- consult(example).
   true.
?- [example].
   % Alternative syntax for consult/1
   true.
?- use_module(example).
   % Works like consult/1 for normal files, but also handles modules.
   true.
?- use_module('example.pl').
   % You can give the full name for every one of those if you like.
   % Scryer Prolog doesn't automatically handle .prolog extension
   % like the .pl extension, so you might need this.
   true.

When I'm testing a module, I usually just prepend use_module(module_name) before all my queries so that I'm always testing the latest version. These don't always work how you would expect them, but it works for most cases.

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@triska
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ocharles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants