What makes a function pure, why it matters, and how to spot hidden side effects.
A pure function always returns the same result for the same inputs, and it does not do anything observable besides returning a value. No I/O. No mutation. No reading the clock. No random numbers.
That sounds academic until you feel the payoff: pure functions are easy to test, easy to refactor, and safe to run concurrently.
1(defn total [prices] (reduce + prices)) ;; pure
As you go through this section, practice reading code and asking: “what inputs does this depend on?” and “what does it change?” If the answer is “only its arguments” and “nothing”, you are looking at a pure function.