You are previewing Clojure in Action.

Clojure in Action

Cover of Clojure in Action by Amit Rathore Published by Manning Publications

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

The best content for your career. Discover unlimited learning on demand for around $1/day.