There are two potential problems. One is that if you load a s(CASP) file using Prolog consult/1, etc. you must be aware that if the file starts with #
, the first line is taken as comment. This allows for #!/usr/bin/env swipl
to make a Prolog file executable on POSIX systems. So, leave the first line blank.
Second, explicitly using scasp_embed
probably gets the module context wrong. Doing all in the user module I get the desired results using
:- use_module(library(scasp)).
:- use_module(library(scasp/human)).
query_human_tree(Query, Human) :-
scasp(Query, [tree(Tree)]),
with_output_to(
string(Human),
human_justification_tree(Tree, [])).
A simpler alternative might be to use the (demo) webserver. It is running at s(CASP) web server and its sources are in examples/dyncall/http.pl
. Simply run as swipl examples/dyncall/http.pl
. First pull the latest sCASP as there was a bug.