O'Reilly logo

Clojure in Action, Second Edition by Amit Rathore and Francis Avila

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required