我应该如何正确实现核心Clojure接口? [英] How should I properly implement the core Clojure interfaces?

查看:94
本文介绍了我应该如何正确实现核心Clojure接口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我正在使用 deftype 在Clojure中实现某些数据结构,那么我应该如何确定核心Clojure接口要实施?

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

我无法执行查找有关各种Clojure界面的全面指南;实际上,我能够找到的唯一相关信息是这个问题,范围非常有限。

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.

我要寻找的是每个核心Clojure的列表接口,并简要说明了它的含义以及何时实现(或者甚至应该实现!),以及 clojure.core 使用它。所有这些接口的继承树的描述或图表也将很有帮助。

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.

推荐答案

优秀的书 Clojure Applied ,作者Ben Vandgrift和Alex Miller在第2章收集和组织数据,位于建立自定义集合下。第39页上的 clojure.lang 中的界面直观图。

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.

这篇关于我应该如何正确实现核心Clojure接口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆