In fact, the way that count works on ISeqs is rather roundabout -- it
only works because all implementations of ISeq in clojure.jar also
happen to implement java.util.List, so count calls Collection.size().
In theory, some user-provided ISeq which didn't implement List would
not respond to count.

It's probably a good idea for interop reasons to have seqs implement
the java collection types, but I don't feel too happy about clojure
code which uses the java Collection interface on seqs.

Phil

On 13 May 2013 15:48, Meikel Brandmeyer (kotarak) <m...@kotka.de> wrote:
> Hi,
>
> Am Montag, 13. Mai 2013 16:16:57 UTC+2 schrieb Sean Corfield:
>>
>>
>> So you think (count (map inc [1 2 3])) should be illegal?
>>
>> (I'm just trying to understand your logic here)
>>
>
> In the hardcore version, yes. In the practical version, probably not. I
> never had to call count on a seq. (Various versions of partition-by or split
> being a notable exception.) (Still a promised O(1) count would be nice for
> reasoning as we have it for contains?. What is clojure.lang.Counted good for
> anyway?)
>
> 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
> 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/groups/opt_out.
>
>

-- 
-- 
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/groups/opt_out.


Reply via email to