Add a ValueCollectingVisitor

This implements a `ValueCollectingVisitor` as per issue #50.

Feedback is appreciated.