Let’s start with something simple: an immutable stack.
Now, immediately I hear the objection: a stack is by its very nature something that changes. A stack is an abstract data type with the interface
void Push(T t);
T Pop();
bool IsEmpty { get; }
You push stuff onto it, you pop stuff off of it, it changes. How can it be immutable?
Continue reading