I tried to use the code but the acc_pairs function call the reduce function which is not defined in the code.