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

查看:36
本文介绍了我应该如何正确实现核心 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.

推荐答案

优秀书籍 Ben Vandgrift 和 Alex Miller 的 Clojure Applied 在第 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天全站免登陆