Defines a custom accumulator function.