added a reduce_in function and a reduce function that also takes an operator as an argument