One of the great things about prolog is the ability to reverse predicates and call them in many different ways. This leads to quite flexible programs if done write and is pretty fun as well sometimes. append/3 is a staple for prolog and an exploration of some of its uses is required.

Append one list to another
? append([a,b,c],[d,e,f],L). L = [a,b,c,d,e,f]

Verify that a list is one list appended to another
? append([a,b,c],[d,e,f],[a,b,c,d,e,f]). true

Remove a prefix from a list.
? append([a,b,c],X,[a,b,c,d,e,f]). X = [d,e,f]

Remove a suffix from a list.
? append(X,[d,e,f],[a,b,c,d,e,f]). X = [a,b,c]

Determine if a pattern exists.
? append(_,[c,d_],[a,b,c,d,e,f]). true

Get all characters between a prefix and suffix
? append([a,bX],[e,f],[a,b,c,d,e,f]). X = [c, d]

Get the first X characters.
? length(X, 3), append(X,_,[a,b,c,d,e,f]). X = [a,b,c]

Get the last X characters.
? length(X, 3), append(_,X,[a,b,c,d,e,f]). X = [d,e,f]

Remove the first X characters from a list
? length(X, 2), append(X,Y,[a,b,c,d,e,f]). X = [a,b] Y = [c,d,e,f]

Remove the last X characters from a list
? length(X, 2), append(Y,X,[a,b,c,d,e,f]). X = [e, f], Y = [a, b, c, d]

Find the last element of a list
? append(_, [X], [a,b,c,d,e,f]). X = f