Updates the current value using the specified transformation function and returns the previous value.
The previous value before the update.
A function that computes the new value based on the current value.