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))).
精彩评论