Functional Programming
Functional programming is a way of building software from pure functions and immutable data instead of mutable state. It makes programs easier to reason about and test, and it powers languages from Haskell to the functional features of JavaScript and Python.
itSoftware engineering | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Intro
Functional Programming
Functional programming is a programming paradigm in which you build programs by applying and composing functions that map values to other values, rather than by running a sequence of statements that update the program's state. The formal foundation of the style is the lambda calculus, developed in the 1930s by Alonzo Church as a model of computation built from function application.
Core ideas
Five ideas shape functional programming:
- Pure functions always return the same result for the same arguments and perform no side effects. A pure function cannot be affected by mutable state, the clock, or user input.
- Referential transparency lets you replace an expression with its value anywhere without changing program behavior. That property is what makes pure code testable and safe to reason about.
- Immutable data is never modified in place. A transformation builds a new value from the old one, which removes an entire class of aliasing bugs.
- First-class functions are values like any other: you can store them, pass them as arguments, and return them from other functions.
- Recursion replaces loops. Repeated work is expressed as a function that calls itself, and common recursion patterns are abstracted into higher-order functions such as map, filter, and fold.
Not every functional language adopts every idea. A language can be pure or impure, strict or lazy, and statically or dynamically typed.
Continue the course
This section is part of the paid course.
See pricing to subscribe, or log in if you already have access.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://en.wikipedia.org/wiki/Functional_programming
Supports
- Functional programming builds programs by applying and composing functions whose definitions are trees of expressions that map values to other values, rather than a sequence of statements that update state
- A pure function always returns the same result for the same arguments and cannot be affected by mutable state or side effects
- Functions are treated as first-class entities that can be stored, passed, and returned like any other value
- Common recursion patterns are abstracted into higher-order functions such as folds and unfolds, playing a role analogous to control structures like loops
- The lambda calculus was developed in the 1930s by Alonzo Church as a formal system of computation built from function application
- Lazy evaluation is used by default in pure functional languages including Miranda, Clean, and Haskell
- Haskell represents I/O and mutable state using monads, derived from category theory, which model computations with effects such as exceptions
- Erlang was developed by Ericsson in the late 1980s for fault-tolerant telecommunications systems and is used by companies including Nortel, Facebook, and WhatsApp
- OCaml, introduced in the mid-1990s, has commercial use in financial analysis, driver verification, robot programming, and static analysis of embedded software
- Haskell has been applied to aerospace systems, hardware design, and web programming
- Scala has been widely used in data science; ClojureScript, Elm, and PureScript are used for the web
- Spreadsheets can be considered a form of pure, zeroth-order, strict-evaluation functional programming system
- Emacs is an extensible text editor family that uses a Lisp dialect for plugins
- Functional programming is taught in many universities, with Scheme a popular choice for teaching programming
- Composability makes functional paradigms suitable for microservices-based architectures
- Many mainstream languages incorporate functional features, including Java since Java 8, Kotlin, C#, Python, Go, Rust, and others
- Immutability can lead to execution efficiency by letting the compiler make assumptions that would be unsafe in an imperative language
- https://en.wikipedia.org/wiki/Lisp_(programming_language)
Supports
- Lisp was created in 1958
- https://en.wikipedia.org/wiki/ML_(programming_language)
Supports
- ML was created in 1973
- ML was conceived to develop proof tactics in the LCF theorem prover
- https://en.wikipedia.org/wiki/Scheme_(programming_language)
Supports
- Scheme was created in 1975 by Gerald Jay Sussman and Guy Steele
- https://en.wikipedia.org/wiki/Miranda_(programming_language)
Supports
- Miranda was first released in 1985 as a fast interpreter in C for Unix systems
- Miranda had a strong influence on the later Haskell language
- https://en.wikipedia.org/wiki/Haskell_(programming_language)
Supports
- Haskell was created in 1990
- By 1987 more than a dozen non-strict, purely functional programming languages existed and Miranda was the most widely used
- At FPCA '87 there was a strong consensus that a committee be formed to define an open standard for such languages
- The Haskell history is organized around Haskell 1.0 to 1.4, Haskell 98, and Haskell 2010
- https://en.wikipedia.org/wiki/John_Backus
Supports
- John Backus delivered the 1977 Turing Award lecture Can Programming Be Liberated from the von Neumann Style?
- Backus worked on a function-level programming language known as FP, and his lecture sparked research into functional programming
- https://en.wikipedia.org/wiki/Erlang_(programming_language)
Supports
- Erlang was developed by Joe Armstrong, Robert Virding, and Mike Williams in 1986 within Ericsson
- Erlang was released as free and open-source software in 1998
- https://en.wikipedia.org/wiki/Scala_(programming_language)
Supports
- Scala first appeared on 20 January 2004, designed by Martin Odersky at EPFL
- https://en.wikipedia.org/wiki/F_Sharp_(programming_language)
Supports
- F# was created in 2005 at Microsoft Research and is an OCaml-influenced language on the .NET platform
- https://en.wikipedia.org/wiki/Clojure
Supports
- Rich Hickey started working on Clojure in 2005 and released it publicly in October 2007
- Clojure is a dynamic, functional Lisp hosted on the JVM
- https://en.wikipedia.org/wiki/OCaml
Supports
- OCaml was created in 1996
- OCaml combines functional programming with an object layer and a strong static type system
- https://en.wikipedia.org/wiki/Elm_(programming_language)
Supports
- Elm is a functional programming language that compiles to JavaScript and targets the browser
- https://plato.stanford.edu/entries/lambda-calculus/
Supports
- The lambda calculus was introduced by Alonzo Church in the 1930s
- The lambda calculus is a formal system for computation built from function application and abstraction
- It forms the theoretical basis of functional programming
- https://www.cse.chalmers.se/~rjmh/Papers/whyfp.html
Supports
- John Hughes's paper argues that functional programming matters for program modularity
- Higher-order functions and lazy evaluation support gluing programs together from small components
- https://www.haskell.org/
Supports
- Haskell is a statically typed, purely functional programming language
- Haskell uses lazy evaluation and provides pattern matching, list comprehensions, and a module system
- https://www.haskell.org/get-started/
Supports
- GHCi is Haskell's interactive environment for evaluating expressions
- The page describes the toolchain for getting started with Haskell
- https://www.haskell.org/tutorial/
Supports
- A Gentle Introduction to Haskell covers types, functions, pattern matching, lists, type classes, input, output, and modules
- Non-strict functions are called lazy and evaluate their arguments by need
- Non-strict constructors permit the definition of conceptually infinite data structures
- Run-time errors such as division by zero and non-termination share the value bottom and are not recoverable
- Errors encountered by the I/O system, such as an end-of-file error, are recoverable
- Pattern matching tries equations top-down and left-to-right, and a call whose equations all fail fails to match
- https://www.haskell.org/onlinereport/haskell2010/
Supports
- Haskell 2010 is the current language and libraries standard, organized as the language with extensions to Haskell 98
- The Maybe type is defined as data Maybe a = Nothing | Just a and encapsulates an optional value
- The report is the canonical reference for expressions, declarations, types, modules, and the standard library
- https://htdp.org/
Supports
- How to Design Programs is a design-oriented textbook used to teach systematic program design
- It emphasizes the systematic design of programs, which pairs naturally with functional structure
- https://clojure.org/about/history
Supports
- Clojure's official history page records Rich Hickey's design work on the language
- https://elixir-lang.org/
Supports
- Elixir is a dynamic, functional language designed for building scalable and maintainable applications
- Elixir leverages the Erlang VM, known for running low-latency, distributed, and fault-tolerant systems
- https://elixir-lang.org/blog/2014/09/18/elixir-v1-0-0-released/
Supports
- Elixir v1.0.0 was released on 18 September 2014 by José Valim
- https://www.erlang.org/
Supports
- Erlang is a programming language for building massively scalable soft real-time systems with requirements on high availability
- Erlang/OTP provides the runtime and design principles for fault-tolerant concurrent systems
- https://www.scala-lang.org/
Supports
- Scala combines object-oriented and functional programming on the JVM
- https://fsharp.org/
Supports
- F# is a functional programming language that runs on the .NET platform
- https://ocaml.org/
Supports
- OCaml is a statically typed functional programming language with an emphasis on expressiveness and safety
- https://elm-lang.org/
Supports
- Elm is a functional language for building browser interfaces that compiles to JavaScript
- https://www.purescript.org/
Supports
- PureScript is a strongly typed, pure programming language that compiles to JavaScript
- https://racket-lang.org/
Supports
- Racket is a general-purpose programming language in the Lisp-Scheme family used in education and research
- https://github.com/sindresorhus/awesome
Supports
- The Awesome hub collects curated lists covering many topics, including functional programming
- https://github.com/lucasviola/awesome-functional-programming
Supports
- The curated list gathers functional programming blog posts, papers, wikis, books, communities, videos, lectures, tools, and repositories
- The list describes Lambda the Ultimate as a community focused on discussing research, papers, and academic topics at a high technical level
- The list names FP Complete as host of School of Haskell, one of the most famous Haskell learning centers
- The list presents Functional Programming Jargon as a project providing a glossary for FP
- The list presents the Functional Javascript Workshop as a functional JavaScript workshop
- The list presents Isabelle/HOL as a generic proof assistant based on higher-order logic
- The list presents Idris Koans as a project for teaching Idris, a functional language with dependent types
- The list presents the C9 Lectures by Erik Meijer as a series on Functional Programming Fundamentals from one of the creators of Haskell
- The list presents Adventure with Types in Haskell by Simon Peyton Jones as lectures on Haskell's type system
- The list presents Functional Programming in Scala as a book revised with new exercises and full coverage of Scala 3
- The list presents Grokking Simplicity as teaching functional programming from first principles with real-world scenarios
- https://github.com/hemanth/functional-programming-jargon
Supports
- The repository provides a glossary of functional programming terms to make learning FP easier
- https://github.com/timoxley/functional-javascript-workshop
Supports
- The repository provides a hands-on workshop for functional programming in JavaScript
- http://lambda-the-ultimate.org/
Supports
- Lambda the Ultimate is a community for discussing programming language research, papers, and theory
- https://www.schoolofhaskell.com/
Supports
- School of Haskell is a learning center for Haskell hosted by FP Complete
- https://www.cl.cam.ac.uk/research/hvg/Isabelle/
Supports
- Isabelle is a generic proof assistant based on higher-order logic
- https://github.com/idris-hackers/idris-koans
Supports
- The repository provides koans for teaching Idris, a general-purpose functional language with dependent types
- https://www.youtube.com/playlist?list=PLTA0Ta9Qyspa5Nayx0VCHj5AHQJqp1clD
Supports
- The playlist holds Erik Meijer's C9 Lectures on Functional Programming Fundamentals
- https://www.youtube.com/watch?v=6COvD8oynmI
Supports
- The video is Simon Peyton Jones's lecture Adventure with Types in Haskell on Haskell's type system
- https://www.manning.com/books/functional-programming-in-scala-second-edition
Supports
- The book teaches functional programming in Scala and covers Scala 3
- https://www.manning.com/books/grokking-simplicity
Supports
- The book teaches functional thinking from first principles using real-world scenarios
- https://gcanti.github.io/fp-ts/
Supports
- fp-ts brings typed functional programming abstractions, including option, either, and task types, to TypeScript
- https://arrow-kt.io/
Supports
- Arrow brings typed functional programming to Kotlin, including typed errors, lenses, and effect types
