In computer science, functional programming is a programming paradigm where programs are constructed by applying and composing functions. It is a declarative programming paradigm in which function definitions are trees of expressions that map values to other values, rather than a sequence of imperative statements which update the running state of the program.
In functional programming, functions are treated as first-class citizens, meaning that they can be bound to names (including local identifiers), passed as arguments, and returned from other functions, just as any other data type can. This allows programs to be written in a declarative and composable style, where small functions are combined in a modular manner.
Functional programming is sometimes treated as synonymous with purely functional programming, a subset of functional programming that treats all functions as deterministic mathematical functions, or pure functions. When a pure function is called with some given arguments, it will always return the same result, and cannot be affected by any mutable state or other side effects. This is in contrast with impure procedures, common in imperative programming, which can have side effects (such as modifying the program's state or taking input from a user). Proponents of purely functional programming claim that by restricting side effects, programs can have fewer bugs, be easier to debug and test, and be more suited to formal verification.[1][2]
Functional programming has its roots in academia, evolving from the lambda calculus, a formal system of computation based only on functions. Functional programming has historically been less popular than imperative programming, but many functional languages are seeing use today in industry and education, including Common Lisp, Scheme,[3][4][5][6] Clojure, Wolfram Language,[7][8] Racket,[9] Erlang,[10][11][12] Elixir,[13] OCaml,[14][15] Haskell,[16][17] and F#.[18][19] Lean is a functional programming language commonly used for verifying mathematical theorems.[20] Functional programming is also key to some languages that have found success in specific domains, like JavaScript in the Web,[21] R in statistics,[22][23] J, K and Q in financial analysis, and XQuery/XSLT for XML.[24][25] Domain-specific declarative languages like SQL and Lex/Yacc use some elements of functional programming, such as not allowing mutable values.[26] In addition, many other programming languages support programming in a functional style or have implemented features from functional programming, such as C++11, C#,[27] Kotlin,[28] Perl,[29] PHP,[30] Python,[31] Go,[32] Rust,[33] Raku,[34] Scala,[35] and Java (since Java 8).[36]
hughesWhyFPMatters
was invoked but never defined (see the help page).clinger1987
was invoked but never defined (see the help page).hartheimer1987
was invoked but never defined (see the help page).kidd2007
was invoked but never defined (see the help page).cleis2006
was invoked but never defined (see the help page).Amath-CO
was invoked but never defined (see the help page).racket-video-games
was invoked but never defined (see the help page).erlang-faq
was invoked but never defined (see the help page).armstrong2007
was invoked but never defined (see the help page).larson2009
was invoked but never defined (see the help page).minksy2008
was invoked but never defined (see the help page).leroy2007
was invoked but never defined (see the help page).haskell-industry
was invoked but never defined (see the help page).hudak2007
was invoked but never defined (see the help page).useR
was invoked but never defined (see the help page).Chambers
was invoked but never defined (see the help page).Novatchev
was invoked but never defined (see the help page).Mertz
was invoked but never defined (see the help page).Chamberlin_Boyce
was invoked but never defined (see the help page).effective-scala
was invoked but never defined (see the help page).java-8-javadoc
was invoked but never defined (see the help page).