If I'm remember correctly, the Counted interface must only be implemented by collection implementations for which it is guaranteed that count() is an O(~1) operation
2015-08-04 17:07 GMT+02:00 Keisuke Fukuda <keisukefuk...@gmail.com>: > Hello, > > I've been investigating the basic data structures and their underlying > concepts in Clojure, particularly focusing on the definitions of coll, seq, > map, vector, set, etc. and their inclusion relationships. > > I saw a Venn diagram in this page[1]. Although it is as of Clojure 1.3, I > confirmed it is still correct. "Counted" interface has its only method > count() and it implies that we can get the explicit size of a "Counted" > collection. > > However, IPersistentCollection, which is actually the definition of > collections, also has count() method. It's a bit surprising to me that even > LazySeq supports count() (indirectly via ISeq). > > Questions: > If IPersistentCollection has count() method, What is "Counted" for? > Is it always reasonable for LazySeq to support count() method? Shouldn't > there be an explicit "CountedLazySeq", > > Thanks. > Keisuke > > [1] http://www.brainonfire.net/files/seqs-and-colls/main.html > > > -- > FUKUDA, Keisuke <福田圭祐> > Tokyo, Japan > Email: keisukefuk...@gmail.com > > -- > 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 > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Laurent Petit -- 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 Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.