implement vq:fold in terms of an iterator
merge default into bug25397
pass State to iterator
We want to be able to zip this iterator with other iterators that also
manipulate the vqstate. Hence we must pass the State explicitly rather
than keeping it opaque inside the iterator state.

Also, some refactoring on read_msg.
merge default into bug25397
return MsgStatus only from iterator
leaving the message reading to the fold
only pass the minimum necessary state to 'next'
i.e. the IndexState. The remainder of the State is encapsulated
inside the iterator state. Technically we only need q{1-4} and delta,
but it's simpler and more obvious to just pass a read-only State
around.
cosmetic
merge default into bug25397
merge degault into bug25397
merge bug25400 into bug25397
which is rather conflict-ridden; essentially requiring the rewriting
of the crux of the change in bug25400 in the context of new iterator.
merge default into bug25397
merge default into bug25397
merge bug25397 into default