Functional programming is a programming paradigm that emphasises the use of pure functions to solve problems, i.e., those that always return the same outputs for a given input and has no side effects, thus avoiding modifying any state outside of their scope.
Functional programming treats programs as evaluating mathematical functions and avoids state and mutable data — this is because it’s difficult to exactly reason what state data is in at a given point. The core idea with functional languages is that:1
- Everything you do with data can be done with functions themselves.
- Recursion is a primary control structure, usually with no loop construct.
- There’s a focus on list processing.
- Discourages or disallows statements.
- Functional programming worries about what is to be computed instead of how it’s computed.
Key concepts
Resources
- Functional Programming in Python, by David Mertz
See also
Footnotes
-
From Functional Programming in Python, by David Mertz. ↩