Hi, Am 04.06.2012 um 23:36 schrieb Jay Fields:
> I have some code that checks for a key as part of a cond statement. If I use > a map everything works fine, but if I ever pass in a sorted-map things fail. > I boiled down the issue to this: > > user=> (contains? (sorted-map 1 2 3 4) :a) > ClassCastException java.lang.Long cannot be cast to clojure.lang.Keyword > clojure.lang.Keyword.compareTo (Keyword.java:102) > > Does anyone else think this is bad behavior, or should I ensure the map isn't > sorted before asking it if it contains a key? The problem is not asking the sorted-map for contained keys but the keys you use. You can't compare numbers to keywords. You probably have to provide your own comparator if you need to mix numbers with keywords. Kind regards 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