Base120 · Composition
Functional Composition
Chain pure operations where output of one becomes input of next
When to use
"Use when processing can be expressed as a chain of pure operations where each output feeds the next. Enables reasoning about each step independently and testing them in isolation."
Example
"A data pipeline — fetch(raw_url) -> parse_json(data) -> validate_schema(json) -> transform(records) -> load(db). Each function is pure (same input, same output), so any step can be tested or replaced independently."
Common misuse
"Introducing side effects or shared state into the chain. Once a step depends on external mutable state, the composition is no longer pure and reasoning about the whole requires reasoning about all the state."