So i have this predicate that has to succeed when L
is the concatenation of the other two lists, X
and Y
. Apparently it doesn't work yet. The question is how could i fix the code fragment. Being new to Prolog i still am not sure how can i implement this correctly, having worked only with procedural programming until now.
% concat(L,X,Y) returns true if L is the concatenation of the lists X and Y
concat([],L,L).
concat([X1|L1],L2,[X1|L3]) :- concat(L1, L2, L3).