Difference between revisions of "Functional programming"
Karl Jones (Talk | contribs) |
Karl Jones (Talk | contribs) |
||
Line 36: | Line 36: | ||
== See also == | == See also == | ||
+ | * [[Comparison of programming paradigms]] | ||
* [[Computer program]] | * [[Computer program]] | ||
* [[Computer programming]] | * [[Computer programming]] | ||
* [[Computer science]] | * [[Computer science]] | ||
* [[Declarative programming]] | * [[Declarative programming]] | ||
+ | * [[Eager evaluation]] | ||
* [[Entscheidungsproblem]] | * [[Entscheidungsproblem]] | ||
* [[Expression (computer science)]] | * [[Expression (computer science)]] | ||
* [[Formal system]] | * [[Formal system]] | ||
* [[Function (mathematics)]] | * [[Function (mathematics)]] | ||
+ | * [[Functional reactive programming]] | ||
* [[Immutable object]] | * [[Immutable object]] | ||
* [[Lambda calculus]] | * [[Lambda calculus]] | ||
+ | * [[Inductive functional programming]] | ||
+ | * [[List of functional programming topics]] | ||
* [[Logic programming]] | * [[Logic programming]] | ||
+ | * [[Nested function]] | ||
* [[Programming paradigm]] | * [[Programming paradigm]] | ||
+ | * [[Purely functional programming]] | ||
* [[Recursion]] | * [[Recursion]] | ||
* [[State (computer science)]] | * [[State (computer science)]] | ||
Line 54: | Line 61: | ||
* [https://en.wikipedia.org/wiki/Functional_programming Functional programming] @ Wikipedia | * [https://en.wikipedia.org/wiki/Functional_programming Functional programming] @ Wikipedia | ||
− | + | *[http://cryto.net/~joepie91/blog/2015/05/04/functional-programming-in-javascript-map-filter-reduce/ Functional programming in JavaScript: Map, Filter, and Reduce] @ cryto.net | |
[[Category:Computer programming]] | [[Category:Computer programming]] | ||
[[Category:Computing]] | [[Category:Computing]] | ||
[[Category:Programming languages]] | [[Category:Programming languages]] |
Latest revision as of 07:01, 17 July 2017
In computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data.
Contents
Description
It uses a declarative programming paradigm: programming is done with expressions.
Depends only on the arguments
In functional code, the output value of a function depends only on the arguments that are input to the function
Therefore calling a function f twice with the same value for an argument x will produce the same result f(x) each time.
Eliminating side effects
Eliminating side effects, i.e. changes in state that do not depend on the function inputs, 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.
History
Functional programming has its roots in lambda calculus, a formal system developed in the 1930s to investigate:
Many functional programming languages can be viewed as elaborations on the lambda calculus.
Logic programming
Another well-known declarative programming paradigm, logic programming, is based on relations.
Imperative programming
In contrast, imperative programming changes state with commands in the source language, the most simple example being assignment.
See also
- Comparison of programming paradigms
- Computer program
- Computer programming
- Computer science
- Declarative programming
- Eager evaluation
- Entscheidungsproblem
- Expression (computer science)
- Formal system
- Function (mathematics)
- Functional reactive programming
- Immutable object
- Lambda calculus
- Inductive functional programming
- List of functional programming topics
- Logic programming
- Nested function
- Programming paradigm
- Purely functional programming
- Recursion
- State (computer science)
External links
- Functional programming @ Wikipedia
- Functional programming in JavaScript: Map, Filter, and Reduce @ cryto.net