Pure Functions

Pure functions are essential for a variety of purposes, including functional programming, concurrency, and reliable UX components. But what does “pure function” mean?

Before we can tackle what a pure function is, it’s probably a good idea to take a closer look at functions. There may be a different way to look at them that will make functional programming easier to understand.

What is a Function?

A function is a process which takes some input, called arguments, and produces some output called a return value. Functions may serve the following purposes:

  • Mapping: Produce some output based on given inputs. A function maps input values to output values.
  • Procedures: A function may be called to perform a sequence of steps. The sequence ...

Get Composing Software now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.