A multimethod is a polymorphic Clojure function whose implementation is selected by applying a user-supplied dispatch function to its arguments. Unlike protocols, it can dispatch on arbitrary values, use custom derivation hierarchies, and gain methods without registering new types. section 15.11 section 15.12
Dispatching a data-driven calculator
Define `calculate` to dispatch on `:op`, then attach implementations with `defmethod`. A `nil` method evaluates leaf pairs, while `:default` reports unsupported expressions. A custom hierarchy can group operations by arity, allowing shared implementations for variable-, one-, and two-argument operations. Evaluating the payment expression produces `205659.10262863498`. section 15.11
Manage multimethod behavior explicitly:
- Extend a declared multimethod at runtime with additional `defmethod` definitions, without registering a new type. section 15.11
- Remove implementations with `remove-method` or inspect registered implementations with `methods`. section 15.11
- Resolve overlapping dispatch matches with `prefer-method`; otherwise, ambiguous methods raise an exception. section 15.11
- Provide a `:default` method to handle unmatched values or throw a targeted exception. section 15.11

