Here we go, bear with me. The over-all goal is to return the max alignment between two lists. If there are more than one alignment with the same length it can just return the first.
With alignment I mean the elements two lists share, in correct order but not necessarily in order. 1,2,3 and 1,2,9,3; here 1,2,3 would be the longest alignment. Any who, know for the predicates that I already have defined.
align(Xs, Ys, [El | T]) :-append(_, [El | T1], Xs),append(_, [El | T2], Ys),align(T1, T2, T).
align(_Xs, _Ys, []).
Then I use the built-in predicate findall to get a a list of all the alignments between these lists? In this case it puts the biggest alignment first, but I'm not sure why.
findall(X,align([1,2,3],[1,2,9,3],X),L).
That would return the following;
L = [[1, 2, 3], [1, 2], [1, 3], [1], [2, 3], [2], [3], []].
That is correct, but now I need a predicate that combines these two and returns the biggest list in the list of lists.