[1] The functions set_head and set_tail return the value undefined. Like assignment, they should be used only for their effect.
[2] We see from this that mutation operations on lists can create garbage that is not part of any accessible structure.
[3] The function get_new_pair is one of the operations that must be implemented as part of the memory management required by a JavaScript implementation.
[4] The two pairs are distinct because each call to pair returns a new pair. The strings are the same in the sense that they are primitive data (just like numbers) that are composed of the same characters in the same order. Since JavaScript provides no way to mutate a string, any sharing that the designers of a JavaScript interpreter might decide to implement for strings is undetectable. We consider primitive data such as numbers, booleans and strings as identical, if and only if they are indistinguishable.
[5] The subtleties of dealing with sharing of mutable data objects reflect the underlying issues of sameness and change that were raised in section 3.1.3. We mentioned there that admitting change to our language requires that a compound object must have an identity that is something different from the pieces from which it is composed. In JavaScript, we consider this identity to be the quality that is tested by ===, i.e., by equality of pointers. Since in most JavaScript implementations a pointer is essentially a memory address, we are solving the problem of defining the identity of objects by stipulating that a data object itself is the information stored in some particular set of memory locations in the computer. This suffices for simple JavaScript programs, but is hardly a general way to resolve the issue of sameness in computational models.
[6] On the other hand, from the viewpoint of implementation, assignment requires us to modify the environment, which is itself a mutable data structure. Thus, assignment and mutation are equipotent: Each can be implemented in terms of the other.
3.3.1 Mutable List Structure