I don't know of it is correct, but I also remember reading that Counted was a "marker interface", i.e. it does not actually add any method but it implies that the count operation will be "fast".
On Tuesday, 4 August 2015, Laurent PETIT <[email protected]> wrote: > 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 <[email protected] > <javascript:_e(%7B%7D,'cvml','[email protected]');>>: > >> 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: [email protected] >> <javascript:_e(%7B%7D,'cvml','[email protected]');> >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to [email protected] >> <javascript:_e(%7B%7D,'cvml','[email protected]');> >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> [email protected] >> <javascript:_e(%7B%7D,'cvml','clojure%[email protected]');> >> 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 [email protected] >> <javascript:_e(%7B%7D,'cvml','clojure%[email protected]');>. >> 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 [email protected] > <javascript:_e(%7B%7D,'cvml','[email protected]');> > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > [email protected] > <javascript:_e(%7B%7D,'cvml','clojure%[email protected]');> > 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 [email protected] > <javascript:_e(%7B%7D,'cvml','clojure%[email protected]');>. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. 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 --- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
