The lesson for me is that this particular problem is exceptionally well suited for imperative code, and makes functional code look terrible in comparison.
This is the case for 80% of real world code in IME.
This is the case for 80% of real world code in IME.