I am writing a rule that searches for a specific integer. I suggested that I could write something like this
find_number(X):-
integer(X),
X > 1, X < 5.
Then expect the result of the query to integer(X)result in X=2, X=3, X=4, false.. Instead, I get the result false. The only way I found this rule is to use numlist/3this
find_number(X):-
numlist(2, 4, NumList),
member(X, NumList).
Can someone explain why this is?
source
share