在编译和运行下面的代码 ( pl_check_input.pl
) 时,我user directive failed
在“:-初始化...”行中得到
:- dynamic(doit/0).
:- initialization(doit).
:- include(head).
doit :-
readFB(user_input),
writeFB,
halt.
:- include(tail).
$ gplc --no-del-temp --no-top-level pl_check_input.pl
$ ./pl_check_input <fb1 >fb2
warning: /home/tarvydas/Dropbox/Projects/vsh/pl-vsh/pl_check_input.pl:2: user directive failed
如果我删除违规行
:- dynamic(doit/0).
:- include(head).
doit :-
readFB(user_input),
writeFB,
halt.
:- include(tail).
$ gplc --no-del-temp --no-top-level pl_check_input.pl
$ ./pl_check_input <fb1 >fb2
Warning: no initial goal executed
use a directive :- initialization(Goal)
or remove the link option --no-top-level (or --min-bips or --min-size)
任何见解都将受到欢迎。
最终,我让这段代码从 运行REPL
,但我想把它放在一个 linux 管道脚本中,并删除顶级/0 附带的各种横幅行。