Implement writeArray(). 23/28 tests passing.