I've been trying for a long time and searched a lot (...) but nothing.
What I want is to create a function that will compare elements of one list to the elements of other list.
The things is I have absolutely no idea how I'm going to iterate through the members of both lists.
Ex. comparing the first member of the first list L1 to the members of L2. If it meets a certain condition (the condition may vary, but compare/4, member and such won't do), I'll pick the second member of L1 to all the members of L2, and so on.
The thing is I don't know how to get back the "full list" L2 after checking through its members while comparing to the first element of L1 by using [P|R]. After that how will I compare the second element of L1 to the elements of L2? Any way to "reset" it back to the first position?
I had something like
function([P|R], [F|L]) :-
P == F,
function([P|R],L)
;
P \== F, (guess not necessary)
function(R, [F|L]).
(it has more stuff but this is pretty much the basic of what I want)
But it exhibits odd behaviour after going through all the members of 1 list.
And yes, it's probably a very basic question but Prolog is just not something I've gotten used to..