【发布时间】:2012-06-09 08:45:27
【问题描述】:
上下文
(doc count)
-------------------------
clojure.core/count
([coll])
Returns the number of items in the collection. (count nil) returns
0. Also works on strings, arrays, and Java Collections and Maps
问题
计数是否保证在向量上是常数时间?
如果没有,有没有办法在常数时间内得到向量的大小?
更多上下文
我实际上想获取向量的列表元素,假设我知道向量的大小,我可以在 O(1) 中用 nth 做到这一点。
编辑:
我忘了提这个。我需要它来处理 transient 向量。
【问题讨论】:
标签: clojure