A lot of code from The Art of Prolog that used some form of accumulator data structure as a third argument to predicates.
append([], L, L).
append([H|T], L2, [H|L3]) :- append(T, L2, L3).
Such that the computation can be run in any direction? Where it will produce the result of appending two lists, or the prefixes and suffixes of a list if the result (third parameter) is known, and so on?