Chapter 4. Polymorphism with multimethods


This chapter covers

  • What polymorphism means
  • What method dispatch is
  • Clojure multimethods and how they work


Many years ago, when I was learning the Java programming language, I read a book by Bruce Eckel called Thinking in Java. Although I thought it was a great book and learned a lot from it, over the years I’ve realized that the title of the book is a specific instance of a common curse. It’s a curse that afflicts a majority of program-mers—if programmers know only a specific language, they soon begin to think only in terms of what’s possible (expressible) in that language.

In our industry, this is manifested in several ways. The most common is that, on average, a programmer fluent in several ...

Get Clojure in Action 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.