Closed XVilka closed 5 years ago
Thank you for opening the issue.
I might need more information on how you are performing the inference. I can not reproduce this error on my files, nor on the online editor.
https://dtai.cs.kuleuven.be/problog/editor.html#task=prob&hash=b61f2e3e4af7df334b6c12f0e1564468
I assume this is the same as #18 where you got it to work?
Ok, sorry for wrongly minizing the sample. It should be then
:- use_module(library(apply)).
byte_nonzero(B, R) :-
B > 0, R = true.
byte_nonzero_acc(B, Acc0, Acc) :-
Acc0, byte_nonzero(B, Acc).
bytes_nonzero(B, R) :-
foldl(byte_nonzero_acc, B, true, R).
some_sample_fact(0, [10, 20, 30], "fact1").
some_sample_fact(10, [10, 0, 30], "fact2").
some_relation(rule, Arg1) :-
some_sample_fact(Arg1, B, _),
call(rule, B, true).
query(some_relation(bytes_nonzero, R), some_sample_fact(A, B, C)).
But now it complains that "No clauses found for 'foldl/4'", strange.
Nevermind, the offending predicate is:
byte_nonzero(B) :- B > 0.
If I write it in the problog shell
.
It is the one that cause this error:
Invalid argument types for call to '>/2': arguments: (X1, 0), expected: (ground, ground).
At the same time the similar predicate works:
byte_zero(B) :- B = 0.
Seems >
operation is defined improperly? Or (more likely) I am doing this wrongly?
Using
:- use_module(library(apply)).
byte_nonzero(B, R) :-
B > 0, R = true.
byte_nonzero_acc(B, Acc0, Acc) :-
Acc0, byte_nonzero(B, Acc).
bytes_nonzero(B, R) :-
foldl(byte_nonzero_acc, B, true, R).
some_sample_fact(0, [10, 20, 30], "fact1").
some_sample_fact(10, [10, 0, 30], "fact2").
some_relation(rule, Arg1) :-
some_sample_fact(Arg1, B, _),
call(rule, B, true).
in SWI-Prolog (https://swish.swi-prolog.org/) and querying for
byte_nonzero(B, true).
will result in a similar error.
Yes, sorry for the noise, seems I got it all wrong.
If I have a rule, like that:
It will throw an error complaining of the different argument types: