Finish HistArray implementation

Beware of bugs in this code. I have only shown it passes the 9 tests I
wrote, not tried to use it :)