Skip to content

Latest commit

 

History

History

functional-programming

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Functional programming (FP)

Functional programming (FP) is a programming paradigm that emphasizes the use of pure functions to solve problems. In this paradigm, functions are treated as first-class citizens and can be used as values in the same way as other data types, such as numbers or strings.

At its core, functional programming is based on the concept of functions. A function in functional programming is a mapping from input values to output values, where the output depends only on the input and not on any external state. This means that given the same input, a function will always produce the same output, regardless of when or where it is called.

Functional programming also emphasizes immutability, which means that once a value is created, it cannot be changed. Instead, new values are created by applying functions to existing values. This makes it easier to reason about code and avoids many of the pitfalls of mutable state, such as race conditions and concurrency issues.

In addition to pure functions and immutability, functional programming also places a strong emphasis on higher-order functions. These are functions that take other functions as input or return functions as output. This makes it possible to create powerful abstractions and compose functions in powerful ways.

Functional programming languages include Haskell, Lisp, ML, F#, and many others. While functional programming has been around for several decades, it has seen a surge in popularity in recent years due to its suitability for concurrent and parallel programming, as well as its ability to handle complex data structures and algorithms.