Create an iterator which removes consecutive values that resolve to the same value according to a provided function.