开发者

Autorun predicate

开发者 https://www.devze.com 2023-02-06 12:39 出处:网络
Is there a way to define autorun predicate, which will run after loading a file? Yeah, I know about swipl -s fil开发者_Go百科e.pl -g \"main.\", but still looking for something, which can be put in so

Is there a way to define autorun predicate, which will run after loading a file?

Yeah, I know about swipl -s fil开发者_Go百科e.pl -g "main.", but still looking for something, which can be put in source file file.pl


:- initialization(main).

Make sure the main directive always calls halt/0, else you will get a toplevel when it fails. Or put in an unconditional call to halt/0:

:- initialization(once(((main ; true), halt))).
0

精彩评论

暂无评论...
验证码 换一张
取 消