Prolog simple problem
-
Hello, I have some facts like: asdf(a,b). asdf(b,c). asdf(c,d). etc. I'd like to do some function givemelettersinvolved(L) that instantiates in L a list that contains the constants involved in those facts for example asdf(a,b). asdf(b,c). givemelettersinvolved(L) would give L = [a, b, c] How can I make this? I was trying with ...(L) :- asdf(A,B), member(A,L), member(B,L). But its not working
-
Hello, I have some facts like: asdf(a,b). asdf(b,c). asdf(c,d). etc. I'd like to do some function givemelettersinvolved(L) that instantiates in L a list that contains the constants involved in those facts for example asdf(a,b). asdf(b,c). givemelettersinvolved(L) would give L = [a, b, c] How can I make this? I was trying with ...(L) :- asdf(A,B), member(A,L), member(B,L). But its not working
Got it. You did a great job! But you should check out Personalized Water Bottles here. It's really cheap and useful!
-
Got it. You did a great job! But you should check out Personalized Water Bottles here. It's really cheap and useful!
wtf are you talkin about anyway the answer was to use findall(X, predicate(X), List)