Skip to content

Functional Programming

Definition

  • "Key linguistic abstraction" of functional languages is the mathematical function.
  • A function maps an input to an output; for the same input, it always produces the same output. Mathematical functions are stateless.
  • Functions are first-class: can be used as input for functions, and produce functions as output.

Compared to Imperative

An Imperative Programming Language...

  • Involves mutable state that changes throughout execution.
  • Commands specify computations by destructively changing state.
  • Procedures (or methods) have side effects that update state and produces a return value.