3 ms·
In the imperative sense of idempotent, a method is idempotent with respect to system state, not just its arguments. It's about repeated calls e.g. a.f(x).
by moeris 4y ago
In the imperative sense of idempotent, a method is idempotent with respect to system state, not just its arguments.
It's about repeated calls e.g.
a.f(x).f(x)
results in the same state as
a.f(x)
Not about repeated application. E.g.
f(f(x)) = f(x)
- cobbal 4y agoRight. If you think about it as a function of the state itself, the 2 definitions agree. If the function is `f(x, state) -> (y, state')`, then f is "imperitively idempotent" when `g(state) = f(fixedX, state).state'` is "mathematically idempotent"