DEV Community

Discussion on: Explain idempotency (in REST) like I'm Five

Collapse
 
machkernel profile image
David Stancu

A great example of an idempotent function is the absolute value function. abs(-4) = 4 abs(4) = 4. Continuing to apply abs() onto itself will always yield the same result.

For those that have done some Elixir before: -4 |> abs |> abs |> ... will always yield 4