Fix collection filtering

The filter implementation inadvertently mapped to the result of the `filter` function, instead of using that result to determine which items to include in the final output.

The tests didn't capture this because they used an identity function as the filter iterator.