我想在用户执行时在终端上显示一个字符串。但是,我想在不调用任何谓词的情况下这样做。例如,如果代码是这样的:
print_sth(String):-write(String).
只有在我明确调用该谓词时才会打印一些字符串。相反,当我们咨询我们的程序时,我希望视图是这样的:
This is a brief tutorial of the program that was called automatically.
?- // Ready to call a predicate here, but the string above was displayed when we consulted the program.
我尝试了这个,但它不起作用:
:- write('This is a brief tutorial of the program that was called automatically. ').
some_predicate():- do_sth().
// ... other stuff follows here.
谢谢!