Identity Function

Identity function is the simplest of the lambda calculus functions, represented by λa.a. It simply returns the argument that it was given.

// F#
fun a -> a

// JS
a => a

# Python
lambda a: a

While it is a simple function, it still has significance in composing functions in that it represents that the value has not changed. For example, if a function is represented by λa.a any of the following would still be true:

let n a =
    a + 0
let n a =
    a * 1

let s a =
    a + ""

Thus we use the identity function to illustrate that the value is unchanged, not necessarily that we immediately return the original value as one may be tempted to think by reading the annotation a => a. The identify function can also be built upon to construct arithmetic functions where identity can represent zero.