在 Clojure 中,我什么时候应该在列表上使用向量,反之亦然?

编程入门 行业动态 更新时间:2024-10-10 17:32:57
本文介绍了在 Clojure 中,我什么时候应该在列表上使用向量,反之亦然?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我读到向量不是序列,但列表是.我不确定使用一个而不是另一个的理由是什么.似乎向量使用得最多,但这有什么原因吗?

I read that Vectors are not seqs, but Lists are. I'm not sure what the rationale is for using one over the other. It seems that vectors are used the most, but is there a reason for that?

推荐答案

似乎我已经不耐烦地回答了我自己的问题,并在 Freenode 上的 #clojure 中提问.鼓励在 Stackoverflow 上回答您自己的问题是件好事:D

Once again, it seems I've answered my own question by getting impatient and asking it in #clojure on Freenode. Good thing answering your own questions is encouraged on Stackoverflow :D

我与 Rich Hickey 进行了一次快速的讨论,这是它的要点.

I had a quick discussion with Rich Hickey, and here is the gist of it.

[12:21] <Raynes> Vectors aren't seqs, right? [12:21] <rhickey> Raynes: no, but they are sequential [12:21] <rhickey> ,(sequential? [1 2 3]) [12:21] <clojurebot> true [12:22] <Raynes> When would you want to use a list over a vector? [12:22] <rhickey> when generating code, when generating back-to-front [12:23] <rhickey> not too often in Clojure

更多推荐

在 Clojure 中,我什么时候应该在列表上使用向量,反之亦然?

本文发布于:2023-11-29 04:13:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1645236.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:什么时候   向量   表上   Clojure

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!