Multimethod
A multimethod is a dispatch mechanism that selects an implementation by applying a dispatch function to multiple arguments, often using their runtime types or values.
Data-Oriented Programming: Reduce software complexity
A multimethod method is a function that provides an implementation for a particular dispatch value.
- How it is used
- Provides extensible polymorphism for generic maps, including single-, multiple-, and dynamic-dispatch designs.
- How deep it goes
- Explains dispatch responsibilities, validation, method wiring, defaults, and three dispatch forms through JavaScript examples.
- Examples
- Demonstrates animal greetings, multilingual animal greetings, name-length behavior, and author-name formatting.
- What you can do after
- Build it from scratch by defining a dispatch function, initializing a multimethod, wiring implementations, and calling it as a regular function.
Read how Data-Oriented Programming: Reduce software complexity explains multimethod →
Clojure: The Essential Reference
A multimethod is a Clojure polymorphic function whose implementation is selected by applying a dispatch function to its arguments.
- How it is used
- Selects polymorphic behavior for values or data using arbitrary dispatch rules rather than type-only method selection.
- How deep it goes
- Explains declaration, method extension, custom hierarchies, removal, inspection, precedence, defaults, and dispatch failures.
- Examples
- Uses a data-driven calculator, runtime operator extension, temperature-based sound speed, collection dispatch, and recursive methods.
- What you can do after
- Build it from scratch, extend implementations, inspect dispatch state, resolve ambiguities, and diagnose unmatched or conflicting methods.
Read how Clojure: The Essential Reference explains multimethod →
Related concepts
- arrows/multimethodsimplemented by · arrows/multimethods is a JavaScript library that provides an implementation of multimethods.
- polymorphic dispatchhas part · Polymorphic dispatch is runtime selection of an operation implementation based on a call's arguments, function value, or context.
- methodhas part · A method is a callable operation associated with an object or type and invoked through that association.
- function overloadingimplements · Function overloading is defining multiple callable operations with the same name but different parameter signatures, with behavior selected according to the call.
- functionkind of · A function is a callable program unit that performs an operation, may accept inputs, and can produce a result or side effect.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

