It throws because it calls the compare function on the value you are
checking and one or more values in the ordered set, and compare throws when
called with 2 values that are of different enough types.


https://github.com/jafingerhut/thalia/blob/master/doc/project-docs/clojure.core-1.5.1/clojure.core/compare.md

Nicola Mometto recently created ticket
http://dev.clojure.org/jira/browse/CLJ-1242 and wrote a patch for it that
would catch such exceptions in some cases, perhaps for contains? calls,
too, and cause them to return false instead of throwing.  It hasn't been
Vetted, so it remains to be seen what the Clojure developers answer to your
"should" question is.

Andy


On Sat, Aug 3, 2013 at 6:47 AM, Jay Fields <j...@jayfields.com> wrote:

> This: (contains? (sorted-map 1 2 3 4) :a)
> Results in this: ClassCastException java.lang.Long cannot be cast to
> clojure.lang.Keyword  clojure.lang.Keyword.compareTo (Keyword.java:102)
>
>  --
> --
> 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