procedure APPEND(ax, y, az, continuation)
trail ← GLOBAL-TRAIL-POINTER()
if ax = [ ] and UNIFY(y, az) then CALL(continuation)
RESET-TRAIL(trail)
a, x, z ← NEW-VARIABLE(), NEW-VARIABLE(), NEW-VARIABLE()
if UNIFY(ax, [a | x]) and UNIFY(az, [a | z]) then APPEND(x, y, z, continuation)
Figure ?? Pseudocode representing the result of compiling the Append predicate. The function NEW-VARIABLE returns a new variable, distinct from all other variables used so far. The procedure CALL(continuation) continues execution with the specified continuation.