Functional programming (source code)

= Functional programming
{wiki}

<Functional programming> emphasizes computation by evaluating and composing <functions>, often using immutable data and expression-based definitions. A <pure function> has no observable <side effects> and returns the same result for the same inputs, allowing substitution of equals for equals. Mapping a square <function> over a list illustrates a direct transformation without an externally updated accumulator. <Higher-order functions> accept or return <functions>, making patterns such as mapping and folding reusable. Functional languages differ in strictness and effect handling; the paradigm does not imply that real programs never perform input or output.