Add a method named pushed that returns the value in the variable pushed . Do not use the Scheme length function to caculate the answer. You may have to think a bit to figure out how to give the variable and the method the same name. Mutable List Structures. Previously we used cons to make pairs.
Cons defines a new pair and sets the car and the cdr pointers at the same time .
There are also ways to change the car and cdr pointers of existing pairs. In general, we need to be very careful when we mutate lists. Let's consider how we'd go about defining a queue without mutable data. We need an operation to add things to the end of the queue and an operation to remove things from the front of the queue. An empty queue is an empty list.