5 ms·
It’s not clear to me what the difference in definition is - even reading the CS definition on Wikipedia, both cases reference the mathematical definition. What
by Infernal 4y ago
It’s not clear to me what the difference in definition is - even reading the CS definition on Wikipedia, both cases reference the mathematical definition. What am I missing?
- moeris 4y agoIn 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"