Re: checking for a key in a sorted map

2012-06-04 Thread Jay Fields
On Jun 4, 2012, at 5:49 PM, Meikel Brandmeyer wrote: >> 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 numbe

Re: checking for a key in a sorted map

2012-06-04 Thread Meikel Brandmeyer
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) > Class

checking for a key in a sorted map

2012-06-04 Thread 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.K