Protocol extension for custom classes, maps, and Java sequences in Clojure

I created a protocol in Clojure 1.2 that processes my own Java classes and has default processing for generic java.lang.Object. The code looks something like this:

(extend-protocol PMyProtocol
  my.java.ClassName
    (protocol-function [c]
      "My Java class result")

  java.lang.Object
    (protocol-function [c]
      "Default object result"))

How can I extend this to have special processing for standard Clojure data structures (in particular, maps, vectors and sequences)?

+5
source share
1 answer

Clojure , clojure.lang.PersistentCollection. Clojure clojure.lang.TransientCollection. , ( ).

+4

All Articles