A higher-order function accepts a function as an argument or returns one. This works because functions are values: they can be stored, passed around, and returned. In Clojure, `fn` creates such values, making it possible to assemble a computation where it is needed. section 2.1.2 section 2.4.2
Pass a transformation to map
A mapping can pair each original key with a new key and a function. `map` applies an `fn` that destructures each rule and calls its function on the original value; `apply merge` combines the results. For example, a person map can become `{:id "1234567", :name "john doe", :avatar "http://focus.on/me.jpg"}`. Explicit `fn` is useful here because the shorter `#()` syntax does not support destructuring. section 2.1.2
`partial` takes a function and some arguments, then returns a function waiting for the remaining arguments. `(def incrementer (partial + 1))` makes `(incrementer 1 1)` return `3`. This avoids hand-writing nested functions for deferred invocation. Unlike automatic currying, Clojure uses an explicit `partial` call; use `fn` when the required argument arrangement needs a custom wrapper. section 2.2.8
Adapt validation for map
Given `validate`, which checks a request against a whitelist, `(map (partial validate #{:id :cache :product}) [valid-req invalid-req])` returns `(true false)`. The generated function holds the whitelist while `map` supplies each request. The eventual call still has to satisfy the underlying function’s arity. section 2.2.8
`memoize` shows another use: it accepts a function and returns a caching wrapper without changing the original. The wrapper stores results by argument values, so a repeated call can retrieve its result rather than recompute it. This is appropriate when the wrapped function’s result depends only on its arguments; other influences could make a cached result wrong. section 2.4.2
Observe a cached call
For a wrapped two-argument addition function that prints on a cache miss, the first `(f 1 2)` prints `Cache miss for [1 2]` and returns `3`. A second `(f 1 2)` returns `3` without printing; `(f 1 3)` prints a new miss and returns `4`. section 2.4.2













