Replace History[] with Arraylike

Arraylike stores histories in a copy-on-write manner and has two
implementations:

	* HistoryArray wraps an array and is thus fast for access and
          great for locality. It takes O(length) time to write.
	* TreeArray is a left-complete binary tree that breaks
          locality, but has O(log(length)) time to write.