So I have a class to create in smalltalk called LazyMatrix. The class only has 1 instance variable and cannot be a subclass of anything but Object. The instance variable of LazyMatrix is called block and must be a back. I initialize LazyMatrix like this:
initialize
block:=[nil]
There will be a method for setting values
setRow:column:value:
This method will redefine the block by setting the new block as [#(i j value).[nil]]. Each subsequent call adds an array of 3 to the block, so it expands like [#(i j value).[#(i j value).[nil]]] much like an s-expression or "lazy list".
So I need to access the head of this block (i.e. [#(i j value) ) as well as the tail of this bock (i.e. [#(i j value).[nil]] ). How do I do this in smalltalk? I know calling value on the block will return the tail... now I need to return the head.