0
votes

I have a simple prolog program:

write_manual:-
   write('------------------------------'),
   write('USAGE MANUAL'),
   write('find_course. - List all the available courses'),
   write('------------------------------').
   % execute this and output this right away when I open the program in the console

Does anyone know to achieve this? I'd like to print a simple help manual before the program starts. Currently, the swi prolog console (on windows 10) shows the ?- prompt and requires me to manually call the predicate. I'm using SWI-Prolog (threaded, 64 bits, version 8.0.0).

1
Does this answer your question? How to run SWI-Prolog from the command line?Guy Coder
@GuyCoder havent been able to get initialization main. to work (nothing is output to the swi console). I'm running the program using the file > consult option of the swi prolog console (not shell).danieln
@GuyCoder see the edits. Yes, I'm running on windows 10danieln

1 Answers

1
votes

This is a comment posted in a question because it doesn't format correctly in a comment.

Running on Windows 10 with SWI-Prolog (threaded, 64 bits, version 8.1.21)

:- initialization main.

main :-
    write_manual.

write_manual :-
    format('------------------------------~n',[]),
    format('USAGE MANUAL~n',[]),
    format('find_course. - List all the available courses~n',[]),
    format('------------------------------~n',[]).

Start SWI-Prolog

?- consult("C:/Prolog/SO_question_160.pl").
------------------------------
USAGE MANUAL
find_course. - List all the available courses
------------------------------
true.

?- 

Note: This was not setup to start from a Windows command line script because the title of the question reads I consult a file.