Functional programming

related topics
{math, number, function}
{theory, work, human}
{system, computer, user}
{language, word, form}
{company, market, business}
{style, bgcolor, rowspan}

In computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the application of functions, in contrast to the imperative programming style, which emphasizes changes in state.[1] Functional programming has its roots in lambda calculus, a formal system developed in the 1930s to investigate function definition, function application, and recursion. Many functional programming languages can be viewed as elaborations on the lambda calculus.[1]

In practice, the difference between a mathematical function and the notion of a "function" used in imperative programming is that imperative functions can have side effects, changing the value of program state. Because of this they lack referential transparency, i.e. the same language expression can result in different values at different times depending on the state of the executing program. Conversely, in functional code, the output value of a function depends only on the arguments that are input to the function, so calling a function f twice with the same value for an argument x will produce the same result f(x) both times. Eliminating side effects can make it much easier to understand and predict the behavior of a program, which is one of the key motivations for the development of functional programming.[1]

Functional programming languages, especially purely functional ones, have largely been emphasized in academia rather than in commercial software development. However, prominent functional programming languages such as Scheme,[2][3][4][5] Erlang,[6][7][8] Objective Caml,[9][10] and Haskell[11][12] have been used in industrial and commercial applications by a wide variety of organizations. Functional programming also finds use in industry through domain-specific programming languages like R (statistics),[13][14] Mathematica (symbolic math),[15] J and K (financial analysis)[citation needed], F# in Microsoft .NET and XSLT (XML).[16][17] Widespread declarative domain specific languages like SQL and Lex/Yacc, use some elements of functional programming, especially in eschewing mutable values.[18] Spreadsheets can also be viewed as functional programming languages.[19]

Full article ▸

related documents
Scheme (programming language)
Kolmogorov complexity
Fourier series
Adjoint functors
Tensor product
Axiom of choice
Limit (category theory)
Numeral system
LR parser
Continued fraction
Closure (computer science)
Fast Fourier transform
Elliptic curve cryptography
Binary search tree
Singleton pattern
Algebraic geometry
Design Patterns
Recurrence relation
Hilbert's tenth problem
Collatz conjecture
Topological space
Dedekind domain
Hash table
Orthogonal matrix
Computational complexity theory
Markov chain