#!/usr/bin/swipl

% The #! line by itself just starts prolog and loads the file.
% To actually have the script "run" something we need to tell it
%    where to start after the load finishes.
% This is done with the initialization command, e.g.:

:- initialization main.   % run the call to main (see bottom of file) once loaded


% checking that the facts.pl successfully loaded,
%    the validLoad goal is (hopefully) defined in facts.pl
runTest(A) :- validLoad(A).

% define the rules for main,
%    currently loads facts.pl and uses our runTest (defined above)
%    to see if it worked ok
main(_) :-
   consult('facts.pl'),   % consult('facts.pl') works like ['facts.pl']
   runTest(ok),
   format("Done~n").

main(1). % actual invocation of main

