I'm not sure if flags is the appropriate term, but is there anyway to configure a swi-prolog program to not output true or false on the completion of a query, and instead simply print out another statement determined in the program?
There is a facility for customising this kind of behaviour, but it can get quite involved. I have not played with it myself but looking at the manual and Prolog boot files might help you.
Prolog has a "top level", which is a bit of Prolog code that controls the Prolog command line and executes the goals entered on it. With SWI-Prolog, you can specify an alternative top level:
pl -t my_quiet_prolog
If you define my_quiet_prolog/0
in a file loaded on startup, e.g. in your ~/.plrc
file.
The default top level is called prolog/0
. The source for this, and other parts of the default Prolog environment can be found in /usr/lib/pl-5.6.36/boot
(on my Cygwin system; possibly different for you). Look at toplevel.pl
for the default top level. The messages 'Yes' and 'No' are also defined, in messages.pl
.
You could try to override the messages, or simply copy the top level and modify it to suite you.
© 2022 - 2024 — McMap. All rights reserved.