On Mon, Jun 14, 2010 at 11:06 AM, Sean Devlin <francoisdev...@gmail.com> wrote: > > This behavior becomes a pain when trying to use into: > > ;Good > user=> (into {} [[:a 1] [:b 2] [:c 3] [:d 4]]) > {:a 1, :b 2, :c 3, :d 4} > > ;Bad > user=> (into {} (partition 2 [:a 1 :b 2 :c 3 :d 4])) > #<CompilerException java.lang.ClassCastException: clojure.lang.Keyword > cannot be cast to java.util.Map$Entry (NO_SOURCE_FILE:...)>
Stuart S. already covered the reasons for this behavior. Given those reasons, a solution that works for your last example there is: (apply array-map [:a 1 :b 2 :c 3 :d 4]) ;=> {:a 1, :b 2, :c 3, :d 4} --Chouser http://joyofclojure.com/ -- 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