PROCEDURE copytail(l, q: liste): BEGIN IF l^.nach <> NIL THEN NEW(q^.nach); q := q^.nach; l := l^.nach; q^.wert := l^.wert; copytail(l, q); ELSE q^.nach := NIL; END; END copytail; PROCEDURE copytail(l, q: liste): BEGIN WHILE l^.nach <> NIL DO NEW(q^.nach); q := q^.nach; l := l^.nach; q^.wert := l^.wert; END; q^.nach := NIL; END; END copytail;
Diese Routine ist bis auf Details identisch mit der früher angegebenen, ad hoc geschriebenen Version; das ist sehr beruhigend.PROCEDURE copy(l: liste; VAR p: liste): VAR q: liste; BEGIN IF l <> NIL THEN NEW(p); q := p; q^.wert := l^.wert; WHILE l^.nach <> NIL DO NEW(q^.nach); q := q^.nach; l := l^.nach; q^.wert := l^.wert; END; q^.nach := NIL; ELSE p := NIL; END; END copy;