liveBook · Manning

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.

How 2 Manning books explain it

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

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.