Pure Functions
Functional programming is the central theme of JAX. This lesson will shed some light on what exactly this means.
We'll cover the following
Functional programming (FP)
Functional programming is a paradigm focused on functions. It’s okay if you are unfamiliar with functional programming because JAX mainly centers around just one of its key features.
Pure functions
Pure functions are similar to mathematical functions and have the following properties:
- Identical outputs: No matter how many times we run the function, it gives the same output for the same tuple of inputs.
- No side-effects: The function doesn’t change any variable other than variables in its local scope.
Examples
Here is a basic example of a pure function:
Get hands-on with 1400+ tech skills courses.