Chapter 4. Multimethod polymorphism

This chapter covers

  • Polymorphism and its types
  • Clojure multimethods for ad hoc polymorphism
  • Using multi-argument dispatch
  • Querying, modifying, and creating dispatch hierarchies

You should now know how to use Clojure’s types and functions and even write some fairly advanced higher-order functions, but you may still be wondering how to build larger systems with functional programming. In this chapter, you’ll learn how to use the most powerful and flexible tool Clojure has for creating and using abstractions in large programs: multimethods.

4.1. Polymorphism and its types

Polymorphism is the ability to use multiple types as though they were the same—that is, you can write the same code to operate on ...

Get Clojure in Action, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.