Dec 28, 2003 #1 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
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
Dec 30, 2003 #2 beerak Programmer Dec 14, 2003 1 CZ 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]. Upvote 0 Downvote
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].
Feb 2, 2004 Thread starter #3 Berndit Technical User Dec 26, 2003 2 DE 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 Upvote 0 Downvote
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