Clojure Tutorial: protocol
This page is WORK IN PROGRESS.
“protocol” is a Clojure data type, kinda like a mix of Java abstract class and Java Interface.
protocol is a set of methods, without implementation.
;; defining a protocol (defprotocol pr3 "my protocol, yay" (m1 [x] "a method.") (m2 ([x] [a b]) "another method"))
Clojure “protocol” and the “expression problem”
Clojure's “protocol” (expression problem) is roughly a layer of mix of java abstract class and class interface.
The “expression problem” isn't really a problem in computer science. It is a problem as in: “Houston, we have a problem.”
I'll have more detailed article later. For now, the best place to see is:
the “Expression Problem” is best explained here: http://c2.com/cgi/wiki?ExpressionProblem but, better is to understand it as the general case of “Cross Cutting Concerns”, explained here: http://c2.com/cgi/wiki?CrossCuttingConcern
If you have a question, put $5 at patreon and message me.