How should I properly implement the core Clojure interfaces?

喜欢而已 提交于 2020-01-04 02:35:13

问题


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.


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/33504959/how-should-i-properly-implement-the-core-clojure-interfaces

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!