A structure cell can be safely reused only when it has no subsequent reference.
Thus, after a dead structure cell has been matched, it has no subsequent reference and can safely be reused.
The auxiliary parameter is needed because the position, within the structure cell given by the last-cell reference, of the field to be updated is not always known at compile time.
Here, as in the previous example, Last contains a reference to the last structure cell incorporated into the output structure.
This means that when a structure cell is reused by a transformed program, it will be reused to construct a structure with the same principal function symbol and arity.
In the context of logic programming and concurrent logic programming, where differently sized structure cells make free lists less practical, several researchers have reused structure cells locally within procedures.
However, while free lists are suitable for a list implementation, they are much less practical for languages that require structure cells of many sizes, as do many logic and functional languages, including Prolog.
In general, the invocations in which parent and child structure cells are reallocated may not be caller and callee, but rather caller and an arbitrary descendant call (as in the example when the caller and descendant are separated by several consecutive invocations of the second clause that delete a run of 1's).
For nonorphan versions of the clause, establishing those links completes the delayed portion of the task of (re)initializing the calling clause's output structure cells.