Short Background on Functional Programming

In functional programming, programs are executed by evaluating expressions. Whereas imperative programming programs are composed of statements that change global state and manipulate variables when executed, functional programs are more akin to mathematical functions. They always map the same outputs to the same inputs (y maps to f(x)) without ever changing the values of the inputs/variables themselves, and they can be chained to each other via inputs and outputs (functional composition). Functional languages with this implementation are called pure functional languages.

Functional languages, because of their "purity" or the statelessness of function computation, also allow for delayed evaluation of the functions. This deferred evaluation is also known as lazy evaluation.

In functional programming, functions are first-class language constructs, meaning that they are treated like any other types. Functions can also be passed as arguments to other functions or returned as results of other functions. Functional languages also enable programmers to define and manipulate anonymous functions, also known as Lambda expressions, which are passed to other functions or nested in code blocks. Nested functions, which manipulate local values, are known as closures.