Protocols provide polymorphism between different data types. Defining protocols are defining Java's interfaces in fact. We can define protocols for Clojure's records and types. It is also possible to define protocols for Java classes.
This section does not make use of any external library, so you can just start a REPL and be ready.
Let's start with defining records and types, and then look at how to define and use protocols.
Here, we will define a record of the author. We have shown how to express the author Sir Conan Doyle using a map in Chapter 2, Interacting with Collections:
{:name "Arthur Ignatius Conan Doyle" :born "22-May-1859" :died "7-July-1930" :occupation ["novelist" "short story writer" "poet" "physician"] :nationality "scottish" :citizenship "United Kingdom" :genre ["Detective fiction", "fantasy", "science fiction", "historical novels", "non-fiction"] :notable-works ["Stories...