Show in graph
{}

Software → Programming

Pure Function

A function whose output depends only on its inputs and which has no side effects.

Motivation

A pure function returns the same output for the same input and has no side effects. It solves the problem of making behavior easier to reason about, test, and compose.

Mental model

Pure functions are predictable boxes: inputs in, output out, no hidden changes.

Where it fits

Pure Function belongs to the Software track, inside Programming. It connects to nearby concepts through the graph relationships on this page and in the graph explorer.

Common mistakes

  • Calling a function pure when it reads time, randomness, or global state.
  • Assuming all useful code can be pure.
  • Hiding mutations inside helper functions.

Use the metadata panel or return to the graph to explore concepts that this one requires or relates to.