Reputation: 67221
I have written a rule like below:
rule_1561_cctype([],_,_,_).
rule_1561_cctype([X1|Y1],[Ru1|Ru1T],[Ru2|Ru2T],[Ru3|Ru3T]):-
X1 is 0 -> Ru1 in {2,3,4}, Ru2 in {-1}, Ru3 in {-1}
;X1 is 1 -> Ru1 in {2,3,4}, Ru2 in {2,3,4}, Ru3 in {-1}
;X1 is 2 -> Ru1 in {2}, Ru2 in {2}, Ru3 in {2}
;rule_1561_cctype(Y1,Ru1,Ru2,Ru3),!.
i am calling this rule like below:
rule_1561_cctype(CctypeInt, Ru1, Ru2,Ru3),
where CctypeInt is integer list.
but i am getting an error below:
935 9 Call: rule_1561_cctype(dom(0..2),dom({-1}\/(2..4)),dom({-1}\/(2..4)),dom({-1}\/(2..4))) ?
! Type error in argument 2 of = /2
! integer expected, but [] found
! goal: _310957=[]
935 9 Exception: rule_1561_cctype(dom(0..2),dom({-1}\/(2..4)),dom({-1}\/(2..4)),dom({-1}\/(2..4))) ?
am i wrong somewhere?
Upvotes: 0
Views: 217
Reputation: 3577
You are doing constraint logic programming, right? The problem is that Prolog tries to unify a constrained variable ranging over a numeric with an empty list and reports an error.
Looking at your code I presume that the call to rule_1561_cctype(Y1,Ru1,Ru2,Ru3) should be rule_1561_cctype(Y1,Ru1T,Ru2T,Ru3T).
Upvotes: 1