The compiler is telling you that there is a mismatch between the flow pattern
(o,i,i,i) you defined for the
normal/4 predicate and what it infers that the code you have written is trying to do --
(i,i,i,i).
Hint: You can improve readability of your code if you restructure some of the predicates to better imply your intent. Also, using meaningful variable names make your program logic easier for you to understand instead of using X, XXX and YY.
For example, restructure normal/3 to be a deterministic predicate that will succeed or fail, rather than return a value.
Code: Select all
class predicates
isNormal : ( integer , integer UpperLimit, integer LowerLimit ) determ.
clauses
isNormal( Y , UpperLimit,LowerLimit ):-
Y < UpperLimit,
Y > LowerLimit, !.
isNormal( _,_,_) = false.
Or if you need to use
true or
false elsewhere, do something like this:
Code: Select all
class predicates
isNormal : ( integer , integer UpperLimit, integer LowerLimit ) -> boolean determ.
clauses
isNormal( Y , UpperLimit,LowerLimit ) = true :-
Y < UpperLimit,
Y > LowerLimit, !.
isNormal( _,_,_) = false.