I am new in Prolog and wanted to learn it. I have been trying to create a list while iterating facts but list that was created one step back refreshing and lost the data. How can I keep the data and add elements to list?
funct(a,b,1).
funct(b,c,2).
funct(b,d,3).
creatingList(X,Y,R):- funct(X,Y,A), funct(Y,Z,B), \+member(B,R) , append(R,B,R).
I tried that , but when I trace it keeps losing data, which I expect is R = [1,2,3].