4

If I'm implementing some data structure in Clojure using deftype, how should I decide which of the core Clojure interfaces to implement?

I was unable to find a comprehensive guide to the various Clojure interfaces; in fact, the only relevant piece of information I was able to find was this question, which is very limited in scope.

What I'm looking for is a list of each of the core Clojure interfaces, with a brief description of what it is and when you should implement it (or if you should even implement it at all!), as well as a list of all the common functions in clojure.core that use it. A description or diagram of the inheritance tree of all these interfaces would also be helpful.

Community
  • 1
  • 1
Sam Estep
  • 12,974
  • 2
  • 37
  • 75

2 Answers2

3

i can not answer all your questions but I usually start from clojure atlas http://www.clojureatlas.com/ to find which interfaces to implement.

mavbozo
  • 1,161
  • 8
  • 10
  • That looks awesome! I had no idea that existed. Unfortunately, I can't accept your answer for the reason you stated. – Sam Estep Nov 03 '15 at 19:42
1

The excellent book Clojure Applied by Ben Vandgrift and Alex Miller provides detailed information on this exact topic in "Chapter 2. Collect and Organize Your Data", under "Building Custom Collections". A visual diagram of interfaces in clojure.lang is provided on page 39.

Sam Estep
  • 12,974
  • 2
  • 37
  • 75