标签: prolog
例如,如果我发出类似between(1,4,X)?的查询,我会期望X=2,X=3之类的内容。这可能吗?
between(1,4,X)?
X=2
X=3
答案 0 :(得分:3)
between(A,B,X):-X is A+1,X<B. between(A,B,X):-A2 is A+1,A2<B-1,between(A2,B,X).