Implement `gather` as a proper Cadence function.

Implement `gather` as a proper Cadence function, instead of passing in
the `step` function. That was bad.

Closes #361.