I am reading up on s(CASP) (good stuff) toying with the following example:
p(X):- q(X, Z), not r(X).
p(Z):- not q(X, Z), r(X).
q(X, a):- X #> 5.
r(X):- X #< 1.
#show p/1.
I added the ‘show’ directive to check that I can cherrypick predicates for the returned model.
When I run the query ‘scasp(p(A), [model(M)])’, the output is
M = [q(A, a)],
{A>5} ;
M = [],
A ∉ [a] ;
A = a,
M = [].
as expected. However if I instead run ‘? p(A)’, exceptions are thrown:
% s(CASP) model
{ q(A,a)
},
{A>5} ;
% s(CASP) model
[[ EXCEPTION while printing message '~W,'
with arguments [scasp_show_model([],[unicode(true)]),[priority(999),quoted(true),portray(true),max_depth(10),spacing(next_argument)]]:
raised: evaluation_error(zero_divisor)
]]
A ∉ [a] ;
A = a,
% s(CASP) model
[[ EXCEPTION while printing message '~W'
with arguments [scasp_show_model([],[unicode(true)]),[priority(999),quoted(true),portray(true),max_depth(10),spacing(next_argument)]]:
raised: evaluation_error(zero_divisor)
]]
;
false.
It may not be a big deal (since I can always use the scasp meta-predicate) but it makes me curious as to what is going on. Any hint is gratefully received.
Audun Stolpe