length2([], 0). length2([_|T], L) :- length2(T, NewL), L is NewL + 1. append2([], L, L). append2([H|T], L, [H|NewFoo]) :- append2(T, L, NewFoo).