Introduction to Functional Programming Language

Functional Programming Language is a programming language that is based on mathematical function. A mathematical function maps members of domain set to another set, called the range set.

*Image Source: https://en.wikipedia.org/wiki/Function_(mathematics)

One of the characteristics of a mathematical function is that their order of expressions evaluation are controlled by recursion and conditional expression, not by sequencing and looping like most imperative languages. Another characteristic of mathematical function is that they do not depend on external values, it maps a certain variable or parameter to a value, unlike imperative languages that focuses on processing the parameter so that it produces a certain value. This characteristic has the advantage to minimize the side effects that happens on certain executions.

*Image Source: https://www.modernescpp.com/index.php/the-definition-of-functional-programming

A function definition in functional programming language is often written as its name, followed by a list of parameters, and its expressions. The parameters that is listed can represent any element of the domain set, but it is set to only represent one specific element during expression evaluation. Also, during the evaluation, every parameter is tied to an element or a value from the domain set, and it is always constant during the evaluation. Hence, during the mapping of a function there is no unbound parameters.

Early theoretical work on functions differentiated the task of defining a function from naming the function. Lambda notation, is a method of defining nameless function. A lambda expression is a nameless function itself. A formal computational model (a formal system for function definition, application, and recursion) using lambda expression is called lambda calculus, which is the inspiration for the functional programming languages.

A pure functional programming language does not use variables or assignment statements. Therefore, iteration is not possible, because it is controlled by variables. That’s why repetition must be done using recursion rather than with iteration. Without variables, The execution of a particular function always produces the same results if it is given the same parameters, this is called referential transparency. This feature makes the semantics of pure functional programming language simpler than imperative languages, and it also makes testing easier, because every particular function can be tested separately without concerning its context.