Functional Programming has no reliance on data outside the current function and there is no change to data that exists outside the current function
This is Functional Programming:
def increment(a): return a + 1
This is NOT Functional Programming:
a = 0 def increment(): global a a += 1
Functional Programming has its origins in lambda calculus, a formal system developed in the 1930s to investigate computability, the Entscheidungsproblem, function definition, function application, and recursion. Many functional programming languages can be viewed as elaborations on the lambda calculus.[2]
There are also some caveats to remember. (Although we show HTTP Request, this is applicable to many other Protocols)
The HTTP PUT and HTTP DELETE methods are defined to be idempotent. However, there is a caveat on HTTP DELETE which if successful would normally return a HTTP 200 (OK) or HTTP 204 (No Content), will often return a HTTP 404 (Not Found) on subsequent calls, unless the service is configured to "mark" resources for deletion without actually deleting them. However, when the service actually deletes the resource, the next HTTP DELETE will not find the resource to delete it and return a 404. However, the state on the server is the same after each HTTP DELETE call, but the response is different.
HTTP GET, HTTP HEAD, HTTP OPTIONS and HTTP TRACE methods are only intended for retrieving data which makes them idempotent as well since multiple, identical requests will behave the same. (Again assuming the state of the resource is the same)