Hi,

On 28 Nov., 14:37, "Michael Wood" <[EMAIL PROTECTED]> wrote:
> I assume (count largecoll) and (empty? largecoll) would be more
> efficient than (seq largecoll)?

Since empty? is implemented as #(not (seq %)) there is no
difference for those. count is O(1) for maps, sets, vectors and
lists. I think, that seq is also O(1). It just provides a view
on a collection. Setting up the view can be as easy as setting
a counter to zero (or even just returning the collection as in
case of a list). But there might be pathological examples,
where this is not the case.

Sincerely
Meikel


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to