Don't use append excessively
From the description of flatten/2 :
...because one would generally append elements one-by-one to a "difference list", or prepend elements one-by-one to a proper list.
append does nothing surprising
It's not optimized in any way.
Clicking on the "source code" button on the top right (see above) reveals that it does exactly what you would do when coding append by hand: recurse down the backbone of
List1 until == has been reached, copying it element by element until the "hole" that is at the end position of the copied backbone copy can be unified with
List2. The end!
The name of append/3 is not so well chosen, it's a bit imperative.
A better name would be concatenation/3.
% Freshvar on position 3 ?- append([1,2],[a,b],X). X = [1, 2, a, b]. % Freshvar on position 2 ?- append([1,2],X,[1,2,a,b]). X = [a, b]. % Freshvar on position 1; append/3 is unsure whether there might be a 2nd solution ?- append(X,[a,b],[1,2,a,b]). X = [1, 2] ; false. % Freshvar on positions 1 and 2; multiple answers! ?- append(X,Y,[1,2,a,b]). X = , Y = [1, 2, a, b] ; X = , Y = [2, a, b] ; X = [1, 2], Y = [a, b] ; X = [1, 2, a], Y = [b] ; X = [1, 2, a, b], Y =  ; false.
Append can handle other things than lists.
I'm not sure whether this is intended, Maybe there should be an exception?
?- append([a,b,c,d],foo,[a,b,c,d|foo]). true.
This is technically correct, but these arguments ain't lists...