【发布时间】:2015-12-23 10:53:36
【问题描述】:
当用户执行它时,我想在终端上显示一个字符串。但是,我想在不调用任何谓词的情况下做到这一点。例如,如果代码是这样的:
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.
谢谢!
【问题讨论】:
-
请更准确地解释一下,我试过了(您是否直接将其输入到文件中并包含它?在提示符下输入?
:-是您输入的内容吗?还是提示?)请更准确地解释,但它不起作用(错误消息?意外结果?)
标签: prolog swi-prolog prolog-toplevel