Persistent immutable lists

Implement persistent immutable lists (purely functional with shared structure), for efficiency.

High-level descriptions of Clojure suggest that Clojure lists are implemented as singly-linked lists, much like Scheme/Lisp lists. One obvious important different is that they are immutable. Another difference is that count is constant time for lists, which I think means that the list must record its own length (possibly in each node?).

It may be that persistent immutable lists can be simply implemented as a record type with two slots: a host list, and a count. A function like rest would extract the host list, then create a new wrapper around the cdr of the host list, with the count decremented.

One important thing to note is that in Clojure, (identical? (rest my-list) (rest my-list)) is true. This suggests that if immutable lists are implemented as a wrapper around host lists, identical? needs to unwrap the wrapper before performing an identity comparison. (Admittedly this feels a bit hacky.)

A "proper" implementation would be to create a new singly-linked list type with three slots: the node value, the tail, and a count. It may be worthwhile investigating the efficiency of this approach versus wrapping a host list.