Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The Clojure corollary to interfaces are called protocols.[185] Interface is a term best kept reserved
for Java interfaces.
A protocol consists of one or more methods, where each method can
have multiple arities. All methods have at least one argument,
corresponding to the privileged this in
Java and self in Ruby and
Python.
The first argument to each method in a protocol is said to be privileged because a particular protocol implementation will be chosen for each call based on it and, more specifically, on its type. Hence, protocols provide single type-based dispatch. This is a very limited form of polymorphic dispatch and it had been chosen for protocols for pragmatic reasons, namely: