What is the performance of `count` on a Clojure set?
clojure
Solution
It is `O(1)`
You can verify this by observing that `clojure.lang.PersistentSet` maintains a `_count` field in the Java source code:
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentList.java
Problem
So, I read that the `count` operation is O(1) for a Clojure vectors, lists and maps. ``` (count [1 2 3]) ;=> 3 ``` But is it also O(1) for a Clojure set? I imagine it probably is, but I'm not really sure how to find out. I had a quick read of http://clojure.org/data_structures#Data%20Structures-Sets, but couldn't see the info there.