The current “recommended” way is
swipl -g "t([1,2],3,Y), writeln(Y)" -t halt app.pl
It would be possible to write a support file query.pl
such that you can do e.g.
swipl query.pl app.pl “t([1,2],3,Y)”
query.pl
would use initialization/2 to start the execution, get the query and print the results. What I think is still missing is a way to comfortably load a library like Python’s -m module
That would allow to put query.pl in the library and run
swipl -m query app.pl "t([1,2],3,Y)"
Would this make sense? If it does, should -m lib
terminate the option list, passing all remaining options to the application? In the above that would mean that the library must decide to load app.pl