当用户执行它时,我想在终端上显示一个字符串。但是,我想在不调用任何谓词的情况下做到这一点。例如,如果代码是这样的:
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.
谢谢!