I got a little bit further in this program. My source code is as follows:
remove(L,[],L).
remove([H|T],[H|S],Z) :- remove(T,S,Z).
remove([R|T],[Q|S],[R|Z]) :- remove(T,[Q|S],Z).
This works in a few cases such as:
-? remove([1,2,3,1],[1,1],X).
giving the result of X = [2,3]
However the result...
I've looked through the forum but this problem seems unique. I'm trying to remove the contents of one list from another. For instance:
removed([1,2,3],[2],X).
should give the result X = [1,3]?
So far the code I have come up with is as follows:
removed(L,[],L).
removed([H|T],[H|S],T) :-...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.