Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help in Prolog

Status
Not open for further replies.

Berndit

Technical User
Dec 26, 2003
2
DE
Hello.
I`m a beginner in Prolog and I need help with the following problem.

interval(X,5,9).
X=5;
X=6;
X=7;
X=8;
X=9;
No

In words:
I need the descriptor intervall(x,a,b) to search all numbers
between a and b (a<=x<=b).

Thank you



 
You can easy modify this predicat:

range(A,B,[A]) :- A = B.
range(A,B,[A|Out]) :- A < B, A1 is A + 1,
range(A1,B,Out).

range(1,5,A).
A = [1,2,3,4,5].

 
Hello
thank you for the answer.
I want to change this predicat like this:

range(X,5,9).
X=[6,7,8].

So I hope you can help me.
Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top