0

Lets say i have simple hello world code

hworld:-writeln('hello world').

This code always returns something like this:

hello world
true.

As far as i understand prolog, it returns either variable value (of X i.e. fact(5,X).) or true/false, if predicate can be solved (i.e. fact(5,120).). What i need is to hide true/false predicate result on stdout (so there will be only results of writeln() predicate). How to do so? Thanks.

false
  • 10,264
  • 13
  • 101
  • 209
Smarty77
  • 1,208
  • 3
  • 15
  • 30
  • You are using a toplevel loop for Prolog. And that loop gives such answers. If you want to omit these answers you must call your Prolog entirely differently - see the manual, but it is not recommended for beginners to start without the toplevel – false Apr 06 '16 at 09:22
  • Why do you *need* to hide the true/false result? – lurker Apr 06 '16 at 10:56
  • Its for a school project, where we were instructed to omit these messages. I found out a bit dirty solution, i did it like this: `hworld:-writeln('hello world'),halt.` – Smarty77 Apr 06 '16 at 13:59
  • That is a bit dirty, but not sure what else one would do with a ridiculous requirement. – lurker Apr 06 '16 at 20:11

0 Answers0