[英]How do I count maps in an array in Clojure?
How do I get the number of maps in the following? 如何获得以下的地图数量?
[{:a "a"} {:b "b"}]
I'm expecting 2
. 我期待
2
。
Just use count
: 只需使用
count
:
(def data [{:a "a"} {:b "b"}] )
(count data) => 2
You may also be interesed in these websites: 您可能还会对以下网站感兴趣:
Create a df(definition)and assign the variable to (atom 0) and count within doseq. 创建一个df(definition)并将变量分配给(atom 0)并在剂量q内计数。
eg (df count-var (atom 0)) (doseq [n vec-of-maps] 例如(df count-var(atom 0))(doseq [n vec-of-maps]
(swap! cnt-var + 1)) (交换!cnt-var + 1))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.