Skip to content

Latest commit

 

History

History
13 lines (10 loc) · 714 Bytes

Append.md

File metadata and controls

13 lines (10 loc) · 714 Bytes

APPEND

AIMA3e

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.