As discussed last time, the solution to our performance problem is to ensure our
_inbound stack doesn’t get too large before we reverse it. This means we need to reverse it early; we can’t leave reversal until it’s needed to replace
If you have a whole sequence of items you want to add to an existing
IImmutableQueue<T>, it’s pretty simple to write a loop to add them all. We can make this even easier by writing a simple extension method that handles the looping on our behalf.
Monday, February 13 2017 sharpen-the-saw
Our stacks and queues don’t exist in isolation - they have to interoperate with standard framework classes and other domain constructs to be useful. For example, it is extremely useful to have some factory methods to make it easier to construct stacks and queues from existing lists and sequences.
Sunday, February 19 2017 admin
I’ve restored a few very old blog posts from 2004-2005, copied from an older version of my blog:
As alluded to previously, having a good suite of unit tests is critical for ensuring these immutable instances do what they should - after all, there’s no point in having a queue or stack that doesn’t behave.